Spreadsheet Practice

RIGHT function

RIGHT returns a set number of characters from the end of a text string. It's the quick way to grab the last digits of a phone or account number, a file extension, or the sequence number at the end of an ID.

Available in
Every current version
Category
Text functions
Returns
Text: the last num_chars characters, or the whole string if it is shorter than that.
Google Sheets
Works the same in Google Sheets.

Syntax

=RIGHT(text, [num_chars])

ArgumentRequired?What it is
textRequiredThe text or cell to read from.
num_charsOptionalHow many characters to return. Leave it out to get just the last character.

Examples

Each result below is calculated from the sample sheet by our formula engine, the same one that grades the practice.

CellFormulaResultWhat it shows
D2=RIGHT(A2,5)00418The last five characters, leading zeros intact
D3=RIGHT(B3,4)0193The last four digits of a phone number
D4=RIGHT(C4,LEN(C4)-FIND(".",C4))docxThe file extension, whatever its length

Try it live

This is the sample sheet. Change any number or text, or edit a formula, and the results update.

Show the sample data as a table
AccountPhoneFileResult
ACCT-00418612-555-0148q3-report.xlsx00418
ACCT-01277763-555-0193budget.csv0193
ACCT-00093952-555-0107notes.docxdocx

Practice RIGHT

From lesson 13, LEFT, RIGHT, MID & LEN. Graded instantly, then re-checked on changed data.

Sequence number

In C2, extract the last four characters. Fill down to C6.

Common mistakes

What you seeWhy, and how to fix it
Blank or short resultsImported text often ends in spaces, so RIGHT returns them. Trim first: =RIGHT(TRIM(A2),4).
Leading zeros vanish when convertedRIGHT returns "00418" as text. VALUE turns it into 418, so leave it as text when the zeros matter.
Decimals come back oddlyRIGHT reads the stored value, not the display. A price shown as $5.50 is stored as 5.5, so =RIGHT(A2,2) returns ".5". Format it first: =RIGHT(TEXT(A2,"0.00"),2).

Tips

  • Drop the first n characters with =RIGHT(A2,LEN(A2)-n).
  • For the text after the last delimiter, =TEXTAFTER(A2,"-",-1) is simpler in Excel 2024 and Microsoft 365.

Questions

How do I get the last 4 digits in Excel?

Use =RIGHT(A2,4). The result is text, so wrap it in VALUE if you need to do math with it.

How do I remove the last character in Excel?

Keep everything but the last character with LEFT: =LEFT(A2,LEN(A2)-1).

Lessons that use RIGHT

Last reviewed October 2026. Every example result on this page is calculated live by the Spreadsheet Practice formula engine.