RIGHTB Function

Excel Functions › Text

All Excel versions DBCS languages

The Excel RIGHTB function returns the last part of a text string measured in bytes rather than characters. Like the rest of Excel’s B functions it exists for double-byte character set (DBCS) languages — Japanese, Chinese, and Korean — where each native character counts as 2 bytes when such a language is the system default. Working in English or any other single-byte language? RIGHTB behaves exactly like RIGHT — just use RIGHT.


Quick answer: to take the last 4 bytes of A2:
=RIGHTB(A2, 4) // last 4 bytes - 2 kanji, or 4 Latin characters
On a Japanese/Chinese/Korean system locale, each DBCS character costs 2 bytes. Everywhere else, RIGHTB counts characters and is identical to RIGHT.

Syntax

=RIGHTB(text, [num_bytes])
ArgumentDescription
textRequiredThe string to extract from.
num_bytesOptionalHow many bytes to return, counted from the right end. Default is 1. Must be zero or positive.

Available in: all Excel versions. Byte counting activates only when a DBCS language (Japanese, Chinese Simplified/Traditional, or Korean) is the system default language; otherwise every character counts as 1 byte and RIGHTB returns exactly what RIGHT would.

RIGHTB vs RIGHT: bytes vs characters

On a Japanese-locale system, 2026東京 occupies 8 bytes — four 1-byte digits then two 2-byte kanji. Asking both functions for “4” from the right shows the difference:

ABC
1Text in A2: 2026東京FormulaResult (Japanese locale)
2byte layout: [1][1][1][1][2][2]=RIGHTB(A2, 4)東京
3=RIGHT(A2, 4)26東京
4=RIGHTB("Dallas", 3)las — same as RIGHT
=RIGHTB(A2, 4) // 4 bytes = the two kanji only
=RIGHT(A2, 4) // 4 characters = "26" plus both kanji

RIGHTB earns its keep with byte-defined suffix fields in legacy East Asian data — the last N bytes of a record, as the file spec defines them:

=RIGHTB(A2, 6) // grab a 6-byte trailing field from a fixed-width record

Try it: char vs byte counter

Live demo

Type text (mix in some kanji or kana), choose num_bytes, and toggle the system locale to see when RIGHTB stops matching RIGHT.

Errors & common pitfalls

Pitfall: results depend on the system language, not the workbook. =RIGHTB(A2, 4) returns two kanji on a Tokyo PC and four characters on a Dallas PC. Byte-based formulas change meaning when the file changes machines — a quiet way for shared workbooks to disagree.

Working in English? Use RIGHT. On single-byte locales RIGHTB is just RIGHT in disguise. RIGHT keeps your formulas portable and your intent obvious.

Pitfall: cutting a character in half. If num_bytes lands mid-character, the orphaned half arrives as a space: =RIGHTB("東京", 3) returns a space followed by 京. A surprise leading space is RIGHTB’s signature glitch — TRIM if in doubt.

#VALUE! — negative num_bytes. A computed count that dips below zero — typically LENB(A2)-FINDB(...) arithmetic — fails. Guard with MAX(0, ...).

Practice workbook

📊
Download the free RIGHTB practice workbook
Every example on this page, ready to open in Excel — plus practice challenges with answers on a separate tab. No sign-up required.

Frequently asked questions

What's the difference between RIGHTB and RIGHT?
RIGHT counts characters; RIGHTB counts bytes. They differ only when a DBCS language (Japanese, Chinese, Korean) is the system default — then each East Asian character costs 2 bytes, so =RIGHTB("2026東京", 4) returns just the two kanji while RIGHT returns four characters.
Why does RIGHTB give me the same answer as RIGHT?
Your system default language isn’t a DBCS language, so Excel counts every character as one byte and the two functions coincide. Expected behaviour — and the cue to simply use RIGHT.
When should I actually use RIGHTB?
When a trailing field is defined in bytes: fixed-width records from Japanese/Chinese/Korean legacy systems, byte-sized database columns, or specs written for DBCS encodings. For everyday suffix extraction use RIGHT — or TEXTAFTER in Excel 365.
What happens if num_bytes splits a double-byte character?
Excel substitutes a space for the orphaned half — =RIGHTB("東京", 3) returns a space then 京, never half a kanji. Wrap the result in TRIM if a leading space would break comparisons downstream.

Master functions like this in one day

This page covers one function. Our Excel Formulas and Functions class covers the 30 that matter most — live, hands-on, taught by professionals in Dallas–Fort Worth, Houston, Austin, Oklahoma City, Denver, or online.

See the Formulas & Functions Class

Related functions: RIGHT · LEFTB · MIDB · LENB · SEARCHB