How to use RIGHT, RIGHTBs function in Excel?

In Excel, the `RIGHT` and `RIGHTB` functions are used to extract a specified number of characters from the end (right side) of a text string. Here’s how each function works and how to use them:

RIGHT Function

  RIGHT(text, [num_chars])
  • Purpose: Extracts a given number of characters from the right end of a text string.
  • Syntax:
    • `text`: The text string from which you want to extract characters.
    • `[num_chars]`: (Optional) The number of characters to extract. If omitted, it defaults to `1`.

Example Usage:

  • Formula: `=RIGHT(“Excel”, 2)`
    • Result: `”el”`
    • Explanation: Extracts 2 characters from the right end of “Excel”.
  • Formula: `=RIGHT(“Excel”)`
    • Result: `”l”`
    • Explanation: Extracts the last character from “Excel” as the `num_chars` is omitted and defaults to 1.

RIGHTB Function

  RIGHTB(text, [num_bytes])
  • Purpose: Extracts a specified number of bytes from the right side of a text string. This is particularly useful for languages that use a double-byte character set (DBCS), such as Chinese, Japanese, and Korean.
  • Syntax:
    • `text`: The text string from which to extract bytes.
    • `[num_bytes]`: (Optional) The number of bytes to extract. If omitted, it defaults to `1`.

Note: In non-DBCS settings, `RIGHTB` behaves the same as `RIGHT` because each character is considered one byte.

Example Usage:

  • Formula: `=RIGHTB(“Excel”, 2)`
    • In a single-byte language, the result is `”el”`.
    • In a multi-byte setting, this extracts the characters up to 2 bytes from the right.

Keep in mind:

  • If the `num_chars` or `num_bytes` is greater than the length of the text string, the full text string is returned.
  • The `RIGHTB` function is mainly applicable in languages that use DBCS, and its behavior might not differ from `RIGHT` in languages like English.

These functions are especially handy for text parsing and manipulation in spreadsheets, where you need to extract fixed portions of text from the right side of entries.

Unlock Your Potential

Excel

Basic - Advanced

Access

Access Basic - Advanced

Power BI

Power BI Basic - Advanced

Help us grow the project