Excel - RIGHTB Function
RIGHTB Function
The EXCEL-RIGHTB function extracts the specified number of characters from the right side of the designated string, depending on the number of bytes. In Microsoft Excel, if the preferred language is selected as the supported language, the RIGHTB function will calculate each character as 2 bytes; otherwise, it calculates each byte as 1. The RIGHTB function is just opposite the LEFTB function. However, both functions work consistently with DBCS languages like Chinese (Simplified), Korean, etc.
Compatibility
This advanced Excel function is compatible with the following versions of MS-Excel −
- Excel for Microsoft 365
- Excel for Microsoft 365 for Mac
- Excel for the web
- Excel 2024
- Excel 2024 for Mac
- Excel 2021
- Excel 2021 for Mac
- Excel 2019
- Excel 2016
Syntax
The syntax of the RIGHTB function is as follows −
=RIGHTB(text, [num_bytes])
Arguments
You can use the following arguments with the RIGHTB function −
| Argument | Description | Required / Optional |
|---|---|---|
| Text | It denotes the text from where the specific number of characters is fetched. | Required |
| Num_bytes | A numeric value that specifies a characters numbers retrieved from the right side of the given string. | Optional |
Points to Remember
- The RIGHTB function will return the same error if the cell reference points to a error value in the first argument.
- The RIGHTB function will retrieve the same result as the RIGHT function, especially when using English.
- If the Num_bytes is smaller than 0, the RIGHTB function will return the #VALUE! error.
- If the Num_bytes is larger than the text strings length, then the RIGHTB function will return the whole text.
Examples of RIGHTB Function
Practice the following examples to learn the use of the RIGHTB function in Excel.
Example 1
The RIGHTB function in Excel is used to extract a specified number of bytes from the end of a text string.
Solution
Step 1 − Consider the sample dataset comprising the list of students in the Korean language.
Step 2 − Enter the formula "=RIGHTB(B3,2)" in the C3 cell and hit the Enter button.
Step 3 − Drag the fill handle(+) sign at the bottom right corner of the C3 cell and drop it to the C9 cell. Therefore, the RIGHTB function will fetch only one character of 2 bytes from the right side of the text string.
Example 2
The RIGHTB function will return the same error if the cell reference points to an error value in the first argument.
Solution
First, locate the pointer in the B3 cell, enter the formula =RIGHTB(D2,3), and press Enter to get the result.
Therefore, the RIGHTB function will retrieve the same error #DIV/0!.
Example 3
If the Num_bytes is smaller than 0, the RIGHTB function will return the #VALUE! error.
Solution
Place the cursor on the B2 cell and enter the formula =RIGHTB("fragrance, ,"-4) and hit Enter.
Example 4
If the Num_bytes is larger than the text strings length, then the RIGHTB function will return the whole text.
Solution
Enter the formula =RIGHTB("Dealers, ",50) in the C4 cell and press the Enter tab. Here, the number of bytes 50 is greater than the string length.
Therefore, the RIGHTB function will return the complete string.