RIGHTB

Formulas / RIGHTB
To extract a specified number of bytes from the right end of a text string, making it useful for handling text in double-byte character sets (DBCS).
=RIGHTB(text, [num_bytes])
  • text - The text string from which to extract characters from the right end.
  • [num_bytes] - [OPTIONAL] The number of bytes to extract from the right end of the text string. If omitted, the default value is 1.

Examples

  • =RIGHTB("OpenAI GPT-3`, 4)

    This formula extracts the last 4 bytes from the text string "OpenAI GPT-3" and returns the result "PT-3". Note that in this case, each character is a single-byte character, so the result includes the last 4 characters.

  • =RIGHTB("こんにちは`, 4)

    This formula extracts the last 4 bytes from the Japanese text string "こんにちは" (meaning "Hello") and returns the result "んち". In this case, each Japanese character is a double-byte character, so the result includes the last 2 characters.


Summary

The RIGHTB function extracts a specified number of bytes from the right end of a text string, and is especially useful for handling double-byte character sets (DBCS).

  • The RIGHTB function is a text function that extracts a specified number of bytes from the right end of a text string, making it suitable for handling double-byte character sets (DBCS).
  • If the optional [num_bytes] argument is omitted, the RIGHTB function defaults to extracting one byte from the right end of the text string.
  • If the [num_bytes] argument exceeds the length of the text string in bytes, the RIGHTB function returns the entire text string.

Frequently Asked Questions

What does the RIGHTB function do?
The RIGHTB function extracts a specified number of bytes from the right end of a text string. It is especially useful for handling double-byte character sets (DBCS), where each character may consist of one or two bytes.
How is the RIGHTB function different from the RIGHT function?
The RIGHTB function extracts a specified number of bytes from the right end of a text string, whereas the RIGHT function extracts a specified number of characters. RIGHTB is useful for handling double-byte character sets (DBCS), where each character may consist of one or two bytes.
What happens if the [num_bytes] argument is omitted in the RIGHTB function?
If the [num_bytes] argument is omitted in the RIGHTB function, the function will extract one byte from the right end of the text string by default.
What happens if the [num_bytes] argument is greater than the length of the text string in bytes?
If the [num_bytes] argument is greater than the length of the text string in bytes, the RIGHTB function will return the entire text string.
Can the RIGHTB function handle text strings in languages with double-byte characters?
Yes, the RIGHTB function is designed to handle text strings in languages with double-byte characters, such as Japanese, Chinese, and Korean. It extracts bytes rather than characters, making it suitable for double-byte character sets (DBCS).
Sourcetable Logo

Work smarter

Al is here to help. Leverage the latest models to
analyze spreadsheets, enrich data, and create reports.

Drop CSV