RIGHT Function
The Excel RIGHT function extracts a specified number of characters from the end of text. If the character count is omitted it returns one character, and an overlong request returns all available text.
| Excel RIGHT Function | |||||||
| RIGHT extracts a chosen number of characters from the end of text. | |||||||
| Text scenarios, editable | RIGHT examples | ||||||
| Scenario | Source text | Characters | Data note | Example | Formula syntax | Result | |
| Reference suffix | INV-2026-A41 | 3 | Final identifier | Reference suffix | =RIGHT(B12,C12) | A41 | |
| File extension | report.xlsx | 4 | Characters after dot | File extension | =RIGHT(B13,C13) | xlsx | |
| Account suffix | EMEA-4821 | 4 | Final digits | Account suffix | =RIGHT(B14,C14) | 4821 | |
| Last name | Avery Chen | 4 | Final word | Last name | =RIGHT(B15,C15) | Chen | |
| Overlong request | OK | 5 | Returns available text | Overlong request | =RIGHT(B16,C16) | OK | |
| How RIGHT behaves | |||||||
| RIGHT starts at the final character and moves left for the requested count. | |||||||
| Punctuation and spaces inside the requested suffix are included in the result. | |||||||
| A count longer than the source text returns the complete source text. | |||||||
| Reliability checks | |||||||
| Reference suffix returns the expected final three characters | OK | ||||||
| Overlong request returns all available source text | OK | ||||||
Overview
The Excel RIGHT function extracts characters from the end of a text value. It is most useful when the required suffix occupies a stable number of character positions.
Quick reference
Syntax: =RIGHT(text, [num_chars])
Returns: One or more trailing characters as text. (text)
Arguments:
text(required) — The text value or cell reference from which to extract characters.num_chars(optional) — The number of characters to return from the right; defaults to 1 when omitted.
The bracketed num_chars argument is optional and defaults to 1. It must be zero or greater, and it controls how many characters are returned from the end of the text.
Common uses
- Extract fixed reference, account, or product-code suffixes.
- Read file extensions when their lengths are known and consistent.
- Return trailing digits or characters from identifiers.
- Extract fixed-length final components from structured labels.
Calculations
RIGHT begins with the final character in text and works backward until it has returned the requested number of characters. The output preserves the original left-to-right order.
When num_chars is omitted, Excel returns the final character. A count equal to the source length returns the complete string. A larger count also returns all available text rather than padding the result.
Spaces and punctuation count as characters. The result is text even when it contains only digits. RIGHT does not locate delimiters, so a fixed count is unreliable when suffix lengths vary.
Function behavior
Situation | Behavior |
|---|---|
| Returns the final character. |
Count equals text length | Returns the entire text. |
Count exceeds text length | Returns all available text. |
Spaces and punctuation | Count as characters. |
Numeric-looking result | Returned as text. |
Negative count | Returns |
Common errors
Using RIGHT when suffix lengths vary
What happens:
Some rows return too few characters or include unwanted delimiters and preceding text.
Better approach:
Use delimiter-aware search and extraction logic when the boundary moves.
Forgetting that punctuation counts
What happens:
A dot, hyphen, or space is unintentionally included or excluded.
Better approach:
Choose the count based on every character in the suffix, including punctuation when it belongs in the result.
Expecting extracted digits to be numeric
What happens:
The result does not behave as expected in arithmetic or numeric comparisons.
Better approach:
Convert with VALUE only when the suffix is guaranteed to be a valid number and leading zeros are not significant.
Example
Example 1 — Extract a Reference Suffix
=RIGHT(B12,C12)
The source is INV-2026-A41, and the requested count is 3. The result is A41.
Example 2 — Extract a File Extension
=RIGHT(B13,C13)
The final four characters of report.xlsx are xlsx. The dot is excluded because the count is four.
Example 3 — Return Trailing Account Digits
=RIGHT(B14,C14)
The source EMEA-4821 returns the four-character suffix 4821. Although the result looks numeric, it is text.
Example workbook
The workbook contains RIGHT Example and Notes tabs. Five live examples cover a reference suffix, file extension, account suffix, fixed-length last name, and overlong request. Two checks confirm the reference suffix and overlong behavior.
Key takeaway
Use RIGHT for stable, fixed-length suffixes; switch to delimiter-aware logic when the boundary can move.