Back to Functions

RIGHTB

Returns the right portion of a string up to a certain number of bytes.

TextRIGHTB(string, num_of_bytes)

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

  1. Extracting bytes from standard text:

    • Example: =RIGHTB("Hello", 3)
    • Result: "llo"
  2. Extracting bytes from double-byte text:

    • Example: =RIGHTB("こんにちは", 4)
    • Result: "には" (each character uses 2 bytes, so 4 bytes captures the last 2 characters)

Use Cases and Scenarios

  1. Multilingual Text Processing: Correctly truncate text containing double-byte characters without splitting a character in half.
  2. Legacy System Integration: Match byte-length constraints required by older systems or fixed-width file formats.
  3. 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.

Related Articles

Newsletter

More RIGHTB examples coming soon.

We are building short, practical updates for Sheets power users.