Text function

RIGHT function

Returns a set number of characters from the end of a text string, e.g. the last 4 digits of a phone or account number.

Available in All versions of Excel, including Microsoft 365, Excel for Mac and Excel for the web

In every Excel versionWorks in Google Sheets

Syntax

RIGHT(text, [num_chars])
ArgumentWhat it means
textRequiredThe text or cell to take characters from.
num_charsOptionalHow many characters to return. Default 1.

Returns: Text: the last num_chars characters.

How RIGHT works

RIGHT is the mirror image of LEFT: it takes characters from the end of the text. =RIGHT(A2,4) gives the last four digits of a phone number, the numeric part of NYC-1042 or the file extension of report.xlsx (with 4 characters).

For parts with variable length, work out how many characters to keep with LEN(A2) - position of the delimiter. For example =RIGHT(A2,LEN(A2)-FIND(" ",A2)) returns everything after the first space, i.e. the surname in Maria Lopez. In Microsoft 365, TEXTAFTER does the same thing more readably and can also start from the last delimiter.

RIGHT reads the stored value, not the formatted display. A cell showing $1,250.50 stores 1250.5, so RIGHT(A2,2) returns .5. Convert the cell with TEXT first if you need the displayed characters. The result is always text.

Examples

1Last four digits of a phone number

B2fx=RIGHT(A2,4)
AB
1Phone
2+30 210 555 01470147

Result: 0147

The last four characters are returned; leading zeros are kept because the result is text.

2Number part after a hyphen

B2fx=RIGHT(A2,LEN(A2)-FIND("-",A2))
AB
1Product code
2NYC-10421042

Result: 1042

The text is 8 characters and the hyphen is at 4, so RIGHT keeps 8 - 4 = 4 characters.

3Surname from a full name

B2fx=RIGHT(A2,LEN(A2)-FIND(" ",A2))
AB
1Full name
2Maria LopezLopez

Result: Lopez

11 characters minus the space at position 6 leaves 5 characters.

4Formatted numbers surprise

B2fx=RIGHT(A2,2)
AB
1Amount
21250.5.5

Result: .5

Even if A2 is formatted as $1,250.50, it stores 1250.5, so the last two characters are .5. Use RIGHT(TEXT(A2,"0.00"),2) to get 50.

⬇Practice workbookExamples with live formulas + practice sheets · .xlsx · 16 KB

Common errors and how to fix them

ErrorWhy it happensFix
#VALUE!num_chars is negative, often because the FIND in the formula failed or the delimiter is missing.Wrap in IFERROR or check that the delimiter exists.

Tips

  • Trailing spaces count. If RIGHT seems to return too little, check the source with =LEN(A2) and TRIM it.
  • =RIGHT(A2,LEN(A2)-3) is a quick way to drop the first three characters.
  • To get the text after the last delimiter in Microsoft 365, use =TEXTAFTER(A2,"-",-1).

Questions

How do I get everything after a character?

Use =RIGHT(A2,LEN(A2)-FIND("-",A2)) or, in Microsoft 365, =TEXTAFTER(A2,"-").

How do I remove the last few characters?

Use LEFT with a shorter length: =LEFT(A2,LEN(A2)-3) drops the last three characters.

Why does RIGHT return digits that do not add up?

RIGHT returns text. Use =VALUE(RIGHT(A2,4)) or --RIGHT(A2,4) to get a number.

Google Sheets

RIGHT also exists in Google Sheets and works the same way for everyday use, so the examples above work there too.

RIGHT in other languages

In a non-English version of Excel the function has a local name. Excel translates formulas automatically when a file is opened in another language.

LanguageFunction name
CzechZPRAVA
DanishHØJRE
DutchRECHTS
FinnishOIKEA
FrenchDROITE
GermanRECHTS
HungarianJOBB
ItalianDESTRA
Norwegian (Bokmål)HØYRE
PolishPRAWY
Portuguese (Brazil)DIREITA
Portuguese (Portugal)DIREITA
RussianПРАВСИМВ
SpanishDERECHA
SwedishHÖGER
TurkishSAĞDAN

Recipes that use RIGHT