For IndividualsFor Analysts & FinanceFor Students & LearnersFor Teams & Automation
MENU
=FUNCTIONS

RIGHT()

Text

Returns a specified number of characters from the end of a text string.

RIGHT(text, [num_chars])

RIGHT mirrors LEFT, pulling characters from the end of a string instead of the start. Omitting num_chars returns just the last character.

Combine with LEN when the piece you need is a fixed distance from the end but the total length varies, e.g. RIGHT(text, LEN(text)-4).

RIGHT is most often used to pull a fixed-width suffix — the last four digits of a card, a year, a check digit. The moment the suffix length varies, the robust form is LEN minus the delimiter position, which adapts to whatever follows. Watch for trailing spaces: an untrimmed value makes RIGHT return the spaces rather than the characters you wanted, and the result looks correct in the cell while failing every comparison. TRIM first, or use TEXTAFTER on a current version, which sidesteps the arithmetic entirely.

Arguments

text
The text to extract characters from.
num_charsoptional
How many characters to return, counting from the right. Defaults to 1.

Examples

=RIGHT("SKU-1049-BLK", 3)
→BLK

Grabs the last 3 characters.

=RIGHT(A2, LEN(A2)-FIND("@", A2))
→example.com

Everything after the @ — LEN minus the delimiter position gives the character count, so the domain length does not matter.

=VALUE(RIGHT(A2, 4))
→1049

RIGHT always returns text. VALUE converts it back to a number so it can be summed or compared numerically.

Notes and gotchas

  • Like LEFT, RIGHT returns text. Extracting the last digits of a reference gives text that will not match a numeric key in a lookup.
  • It is the usual way to pull a fixed-length suffix — a 4-digit year, a 3-character currency code — where the prefix varies in length.
  • For a suffix after a delimiter, RIGHT(A2, LEN(A2)-FIND("|", A2)) works, but TEXTAFTER is far clearer on modern Excel.
  • Trailing spaces count, so a value padded by a fixed-width export returns spaces rather than the characters you wanted. TRIM first.
  • To find the last occurrence of a delimiter, the SUBSTITUTE/CHAR(1) trick is the classic approach on older versions.

Common errors

What goes wrong with RIGHT, and why
You seeBecauseFix
#VALUE!A negative character count, usually from a LEN - FIND expression where FIND failed.Wrap the FIND in IFERROR and decide what should happen when the delimiter is absent.
Tips / Tricks / Hacks

RIGHT tricks, tips, and workbook hacks

RIGHT pulls characters from the tail end of a string—used constantly for last-4-digit account masking, file extensions, postal code suffixes, and parsing trailing codes. When the suffix after a delimiter has a variable length, subtract FIND() from LEN() to calculate how many characters sit to the right of the separator.

Watch out for trailing spaces from database exports: if a cell contains "INV-1042 ", RIGHT(A2, 4) will grab one digit and three spaces unless you wrap A2 in TRIM() first.

Quick RIGHT checks before trusting the result

  • Always wrap imported strings in TRIM() before taking RIGHT() so trailing whitespace doesn't eat your character count.
  • Use =RIGHT(A2, LEN(A2)-FIND("-", A2)) to extract everything after the first hyphen.
  • To extract text after the LAST occurrence of a repeated delimiter (like a folder path "C:/Reports/2026/Q1.xlsx"), combine RIGHT with SUBSTITUTE and LEN.
RIGHT tricks and formula patterns
RIGHT patternRIGHT formulaBest useWatch out
Extract variable-length text after a delimiter=RIGHT(A2,LEN(A2)-FIND("-",A2))Pulling the order number after a prefix like "ORD-98412" or "US-441".Unlike LEFT, you do NOT subtract 1 here—LEN minus FIND already equals the exact character count after the delimiter.
Extract filename after the last slash in a path=TRIM(RIGHT(SUBSTITUTE(A2,"/",REPT(" ",100)),100))Getting "Q1-Report.xlsx" from "https://site.com/files/2026/Q1-Report.xlsx" regardless of how many slashes exist.Classic Excel idiom that works in every version from Excel 2007 to 365.
Pad a number with leading zeroes using RIGHT=RIGHT("00000"&A2,5)Formatting US ZIP codes or 5-digit employee IDs as true 5-character text strings for system uploads.More portable than Format Cells when exporting to CSV.
Common RIGHT mistakes and how to fix them
RIGHT mistakeWhat happens in RIGHTFix
Trailing spaces ruining fixed-width extraction=RIGHT(A2, 2) on " Austin, TX " returns "X " instead of "TX".Write =RIGHT(TRIM(A2), 2).
Using FIND's position directly as num_chars in RIGHT=RIGHT(A2, FIND("@", A2)) returns the wrong number of characters because FIND measures from the left, not the right.Always subtract from the total length: LEN(A2) - FIND("@", A2).

RIGHT practice drills

  1. Extract the domain name after "@" from 5 email addresses of varying lengths using LEN(A2)-FIND("@", A2).
  2. Use the SUBSTITUTE + REPT(" ", 100) + RIGHT + TRIM pattern to pull the last word out of multi-word product names.

Related functions