The RIGHTB function in Google Sheets returns the rightmost portion of a string, up to a specified number of bytes rather than characters. It's especially useful when handling text that includes double-byte characters, such as Japanese or Chinese script. Dive into our comprehensive guide to master its use.
Parameters
string: The text from which to extract the right portion.num_of_bytes: The number of bytes to extract from the end of the string.
Step-by-Step Tutorial
-
Extracting bytes from standard text:
- Example:
=RIGHTB("Hello", 3) - Result:
"llo"
- Example:
-
Extracting bytes from double-byte text:
- Example:
=RIGHTB("こんにちは", 4) - Result:
"には"(each character uses 2 bytes, so 4 bytes captures the last 2 characters)
- Example:
Use Cases and Scenarios
- Multilingual Text Processing: Correctly truncate text containing double-byte characters without splitting a character in half.
- Legacy System Integration: Match byte-length constraints required by older systems or fixed-width file formats.
- Data Formatting: Extract suffixes or codes from text fields with byte-based length requirements.
Related Functions
RIGHT: Returns the right portion of a string up to a certain number of characters.LENB: Returns the length of a string in bytes.