Function · Text
Excel RIGHT function
The Excel RIGHT function returns the last characters of a text value. The last five characters of INV-10428 are 10428.
Syntax =RIGHT(text, [num_chars])
=RIGHT("INV-10428",5)Arguments
| Name | Required | What to pass |
|---|---|---|
| text | Required | The text, or a cell that holds it. |
| num_chars | Optional | How many characters to take from the end. The default is 1. |
Examples
The numeric tail of an invoice id
=RIGHT(B1,5)Result 10428
| A | B | |
|---|---|---|
| 1 | Invoice | INV-10428 |
| 2 | Last 5 | 10428 |
RIGHT takes characters from the end. INV-10428 is nine characters, and the last five are 10428. The hyphen is not one of them. The result is text, even when every character is a digit. Summing a column of those tails will ignore them until you convert with VALUE, and VALUE will drop a leading zero.
Use RIGHT for a suffix whose position is fixed. Use SEARCH or FIND plus MID when the piece you want sits after a word that moves.