Formula Guide

The Excel RIGHT Function
explained simply

RIGHT extracts characters from the end of a text value. Use it to pull file extensions, last digits of codes, suffixes, and trailing identifiers.

ExcelPro · 6 min read · Updated June 2026
Contents
  1. What does RIGHT do?
  2. Syntax
  3. 5 real examples
  4. Dynamic extraction with LEN and FIND
  5. FAQ

What does RIGHT do?

RIGHT extracts a specified number of characters from the end (right side) of a text string. Use it to get file extensions, last digits of account numbers, country codes at the end of a string, or any fixed-length suffix.

Syntax

=RIGHT(text, [num_chars])
ArgumentDescription
text requiredThe text string or cell reference to extract from.
num_chars optionalHow many characters to extract from the right. Defaults to 1.

5 real examples

Example 1
Extract file extension
=RIGHT(A2, 4) ← "report.xlsx" → "xlsx"
Example 2
Get last 4 digits of account number
=RIGHT(A2, 4) ← "****-****-1234" → "1234"
Example 3
Extract year at end of code
=RIGHT(A2, 4) ← "Q3-REPORT-2026" → "2026"
Example 4
Check if a value ends with a suffix
=IF(RIGHT(A2, 3)="Ltd", "Company", "Individual")
Example 5
Extract last word dynamically
=RIGHT(A2, LEN(A2) - FIND("*", SUBSTITUTE(A2," ","*",LEN(A2)-LEN(SUBSTITUTE(A2," ","")))))

Complex but powerful — extracts the last word regardless of string length.

Dynamic extraction with LEN and FIND

Extract everything AFTER a known separator:

Extract after the last hyphen: =RIGHT(A2, LEN(A2) - FIND("-", A2)) "INV-001" → "001"

FAQ

What if the string is shorter than num_chars?
RIGHT returns the whole string without error. =RIGHT("Hi",100) returns "Hi".
Can I extract from the middle of a string?
Use MID instead: =MID(A2, start, num_chars) extracts from any position.
How do I remove the last N characters instead of extracting them?
Use LEFT with LEN: =LEFT(A2, LEN(A2)-N) extracts everything except the last N characters.

RIGHT in data parsing and code extraction

RIGHT is most useful when your data has a consistent structure where the meaningful piece comes at the end. File extensions, country codes appended to product codes, year digits at the end of reference numbers, and check digits at the end of identifier strings all suit RIGHT perfectly.

A common real-world use is extracting the year from invoice references like "INV-2026-001" — but here YEAR or RIGHT from the end won't work because the year is in the middle, not the end. RIGHT works for "001-2026" where the year is at the end. Recognising which end your data is structured from is the key to choosing between LEFT, RIGHT, and MID.

RIGHT combined with LEN creates a powerful pattern for removing a known prefix of variable length: =RIGHT(A2, LEN(A2)-FIND("-",A2)) extracts everything after the first hyphen, regardless of how long the prefix is. This generalises to any separator and handles variable-length strings cleanly.

Practise LEFT, RIGHT and MID

ExcelPro has text extraction exercises across all specialist tracks. Free to start.

Try text exercises →

Related formulas

LEFT MID LEN FIND TRIM SUBSTITUTE