RIGHT: extract the ending of a code or text value
RIGHT is useful for fixed-length suffixes: an extension, an identifier ending or the last few characters of a label. The word “fixed” matters here.
Formula syntax
=RIGHT(text, [num_chars])
What goes into it
text
Text to extract from.
num_chars
Optional number of characters from the right; defaults to 1.
A quick example first
=RIGHT("CellLingo",5)
Returns “Lingo”.
=RIGHT(A2,LEN(A2)-FIND("-",A2))
Returns text after the first hyphen when one exists.
Preserve a numeric-looking code suffix
Enter these codes as text in A2:A4.
| Cell | Code |
|---|---|
| A2 | INV-0042 |
| A3 | PO-019 |
| A4 | INV-EAST-07 |
| Formula | Expected result / interpretation |
|---|---|
| =RIGHT(A2,4) | 0042 as text |
| =RIGHT(A3,LEN(A3)-FIND(“-“,A3)) | 019 as text |
| =RIGHT(A4,LEN(A4)-FIND(“-“,A4)) | EAST-07 — everything after the first hyphen |
RIGHT counts characters from the end. Combining it with LEN and FIND calculates how many characters follow the first separator. That is different from extracting the final segment of a multi-part code. Keep the leading zeros if the suffix is an identifier rather than a quantity.
Before you copy this into a real sheet
Test a code with no hyphen, two hyphens and a trailing hyphen. The missing-hyphen case makes FIND return an error; decide whether to preserve the entire original code or flag it. A fixed four-character extraction truncates longer suffixes. Converting the result with VALUE discards leading zeros, so only do that when arithmetic is intended. TEXTAFTER with a negative instance number can target the last delimiter in supported newer Excel versions.
Useful habits
- Combine with LEN and FIND/SEARCH for variable-length extraction.
- Use TEXTAFTER in newer Excel versions when the delimiter is the real concept.
- Test formulas against rows with no delimiter.
Where people get caught out
- Using a fixed character count when source strings vary.
- Ignoring error cases where the delimiter is absent.
Other functions worth a look
A detail worth remembering
Leading zeroes in identifiers can disappear when a code is stored as a number. Confirm whether the source should be text before extracting characters.
Reference and examples
The examples above use small, invented datasets and English-language formula names. Check your Excel version and argument separator against the official Excel function reference if a formula behaves differently on your computer.