Cellwise Try it free

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 from this sample sheet by the same spreadsheet engine the Cellwise app uses.

ABC
1FileAccountInvoice
2q3-report.xlsx4532-8812-0097-6621INV-2024-0457
3logo.png6011-4471-2290-3318INV-2024-0458
4notes.txt3782-9921-0045-1176INV-2025-0012
  1. =RIGHT(B2,4)

    Result: 6621

    Returns the last four digits of the account number.

  2. =RIGHT(C4,4)

    Result: 0012

    Pulls the running number off the end of the invoice ID.

  3. =RIGHT(A3,LEN(A3)-FIND(".",A3))

    Result: png

    Everything after the dot: the file extension "png".

  4. ="**** "&RIGHT(B3,4)

    Result: **** 3318

    Builds a masked card number for a receipt.

How to use RIGHT

  1. Click the cell for the result.
  2. Type =RIGHT( and select the text cell.
  3. Add a comma and how many characters to keep from the end.
  4. 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

Related functions

Updated