Excel function

RIGHTfunction

Returns the given number of characters from the end (right) of a text.

All versions
=RIGHT("A-2026-0457", 4)

Text11 chars

1A
2-
32
40
52
66
7-
80
94
105
117

Result4 chars

10
24
35
47

Click a character to take everything from there to the end. Try breaking it on purpose to see the errors.

Result

0457

text

The text to take characters from. Spaces count as characters.

num_chars

How many characters to take from the end. If omitted, 1; if longer than the text, the whole text.

What is the RIGHT function?

=RIGHT(text, [num_chars])

RIGHT returns the given number of characters from the end of a text. Use it for the serial at the end of a code, the last digits of a phone number or a file extension.

Click a character to take everything from there to the end; num_chars in the formula changes too.

Arguments

text
The text or cell to take characters from.
num_chars
Optional. How many characters to take from the end. If omitted, 1; if longer than the text, the whole text is returned.

RIGHT examples

  1. Example 1. Number at the end of a code

    =RIGHT("A-2026-0457", 4)

    The last 4 characters, "0457".

  2. Example 2. Example from Microsoft

    =RIGHT("Sale Price", 5)

    "Price".

  3. Example 3. Domain after @

    =RIGHT(A2, LEN(A2)-FIND("@", A2))

    The total length minus the position of @ is the number of characters after it.

Common mistakes

FAQ

Can I combine it with LEFT?
Yes, join them with &: =LEFT(A2,1)&RIGHT(A2,4).
num_chars omitted?
Only the last character is returned.