Text function
Excel RIGHT function
RIGHT returns the last few characters of a text value. Use it for the last four digits of a card or phone number, a file extension, or a suffix at the end of an ID.
=RIGHT(text, [num_chars])Arguments
text- The text or cell to take characters from.
num_chars- How many characters to return from the end. Leave it out to get just the last one.
RIGHT examples
Every result below was calculated live from this sample sheet.
| A | B | C | |
|---|---|---|---|
| 1 | File | Account | Invoice |
| 2 | q3-report.xlsx | 4532-8812-0097-6621 | INV-2024-0457 |
| 3 | logo.png | 6011-4471-2290-3318 | INV-2024-0458 |
| 4 | notes.txt | 3782-9921-0045-1176 | INV-2025-0012 |
Result: 6621
Returns the last four digits of the account number.
Result: 0012
Pulls the running number off the end of the invoice ID.
Result: png
Everything after the dot: the file extension "png".
Result: **** 3318
Builds a masked card number for a receipt.
How to use RIGHT
- Click the cell for the result.
- Type =RIGHT( and select the text cell.
- Add a comma and how many characters to keep from the end.
- Close the bracket.
Common RIGHT mistakes
Trailing spaces
An invisible space at the end counts as a character. Use RIGHT(TRIM(A2),4).
Expecting a number
RIGHT returns text, so "0457" stays text. Wrap it in VALUE if you need 457 as a number.
RIGHT FAQ
How do I get the last 4 digits in Excel?
Use =RIGHT(A2,4). If the cell holds a number, the result is text, so wrap it in VALUE to use it in math.
How do I extract text after a character in Excel?
Combine RIGHT, LEN and FIND: =RIGHT(A2,LEN(A2)-FIND("-",A2)) returns everything after the first dash. In Microsoft 365, TEXTAFTER does the same.
How do I remove the last character in Excel?
Use LEFT with LEN: =LEFT(A2,LEN(A2)-1) keeps everything except the final character.
Practice RIGHT in these lessons
Guides that use RIGHT
- How to remove characters from a cell in Excel
- Excel formulas cheat sheet: the 25 everyone should know
Related functions
LEFTCharacters from the startMIDCharacters from the middleLENLength of textFINDPosition of text (case-sensitive)
Updated 2026-10-31