Description
Use this function to return a specified number of characters from the end of a text string. Supported in Chains.
Syntax
RIGHT(text, [num_chars])
Inputs
This function accepts the following arguments:
| Name | Required | Description | Valid input |
|---|---|---|---|
text |
Yes | The text string from which you want to extract characters. | A cell reference, a number, a text string, or a formula which results in any of these. |
num_chars |
No | The number of characters you want to extract from the start of the text. | A positive integer, a cell reference containing a positive integer, or a formula which results in either of these. If omitted, defaults to 1. |
Example
Sample data
| A | B | ||
|---|---|---|---|
| 1 | 1 | Workiva | |
| 2 | 2 | 01 (123) 456-7890 | |
| 3 | 3 | John Doe | |
| 4 | 4 | ABC123 | |
| 5 | 5 May 2024 | 4/6/2024 | |
| 6 | eggplant | The quick brown fox |
Sample formulas
| Use case | Formula | Explanation and Result |
|---|---|---|
| Extract a specific number of characters from the end of a text string. | =RIGHT(A6, 5) |
Returns the last 5 characters of "eggplant". Result: plant |
| Pull the local number out of a phone number, dropping the area code. | =RIGHT(B2, 8) |
Returns the last 8 characters of "01 (123) 456-7890". Result: 456-7890 |
| Extract the last name from a full name. | =RIGHT(B3, LEN(B3)-FIND(" ", B3)) |
Finds the space in "John Doe," then returns everything after it. Result: Doe |
| Get just the last character of a text string. | =RIGHT(B4) |
With no num_chars specified, returns only the final character of "ABC123".Result: 3 |
| Ask for more characters than a text string actually has. | =RIGHT(B1, 10) |
"Workiva" is only 7 characters long, so RIGHT returns the whole string instead of erroring out. Result: Workiva |
| Extract characters from the end of a date, using another cell to set how many. | =RIGHT(B5, A4) |
Uses the value in A4 (4) as the character count. Since B5 is stored as a date rather than text, RIGHT operates on its underlying serial number rather than the displayed "4/6/2024," returning the last 4 digits of that serial value. Result: 5447 |
| Extract a fixed number of characters from a date that's stored as text. | =RIGHT(A5, 8) |
Because A5 is text rather than a real date, RIGHT reads it literally — and since "May 2024" is exactly 8 characters, the whole value is returned. Result: May 2024 |
| Return everything except the first few characters of a text string. | =RIGHT(B1, LEN(B1)-3) |
Calculates the length of "Workiva" minus 3, then returns that many characters from the end — effectively dropping the first 3 characters. Result: kiva |
| Extract just the last word from a sentence. | =RIGHT(B6, FIND(" ", B6, LEN(B6)-LEN(SUBSTITUTE(B6, " ", "")))-1) |
Locates the last space in "The quick brown fox" and returns everything after it. Result: fox |
Notes
- If
num_charsis greater than the length of text, RIGHT returns the entire text. - If
num_charsis omitted, RIGHT defaults to 1, returning only the last character. - If
num_charsis 0, RIGHT returns a blank cell. - RIGHT treats each character, including spaces and punctuation, as one unit.
- For non-text inputs, RIGHT attempts to convert the value to text before processing.
- RIGHT can be nested within other functions or combined with other text functions for more complex text manipulation.
Tips
- Combine RIGHT with LEN to extract all but the first n characters of a string.
- Combine RIGHT with FIND or SEARCH to extract substrings up to a specific character or delimiter.
- When working with dates stored as text, use RIGHT to extract the year or month.
- For extracting characters from the start of a string, use LEFT instead.
- Combine RIGHT with SUBSTITUTE to remove unwanted characters from the end of a text string.