ExcelReady
CourseMock testsFunction guidesBlog
Start freeStart learning for free
ExcelReady

Be Excel-ready before day one. Hands-on practice in your browser, with instant feedback.

Learn

  • Course
  • Mock tests
  • Function guides
  • Blog

Test prep

  • Excel test practice
  • Free screening quiz
  • Certificate

Company

  • Editorial policy
  • Contact
  • Terms
  • Privacy

© 2026 ExcelReady. All rights reserved.

Function guides / RIGHT

The RIGHT function in Excel

RIGHT returns a set number of characters from the end of a text value. It's ideal when the part you need sits at the end, like the last four digits of an account or a size code on a SKU. Combine it with LEN and FIND when the length varies, such as a file extension.

Syntax

=RIGHT(text, [num_chars])
textThe text or cell to take characters from.
num_charsOptional. How many characters to return, counting from the right. If left out, you get just the last character.

Try it yourself

This is a live spreadsheet. Type the formula and press Enter.

The last 2 characters of each SKU are the size code. In C2, use RIGHT to extract the size from the SKU in A2.

fx
ABCDEFG
1
SKU
Product
Size
2
TEE-NAVY-XL
Crew tee
3
HOOD-GRY-MD
Zip hoodie
4
JKT-OLV-SM
Field jacket
5
TEE-WHT-LG
Crew tee
6
7
8

Tip: Tell RIGHT which cell to read and how many characters the size code has.

Examples

=RIGHT(A2,4)→ "8823"

Returns the last four characters of the account number.

="****"&RIGHT(A3,4)→ "****7104"

Masks an account number so only the last four digits show, a common requirement for reports shared outside the finance team.

=RIGHT(B3,LEN(B3)-FIND(".",B3))→ "xlsx"

The full length minus the position of the dot is the number of characters after it. That gives the file extension, whatever its length.

Example data

1AccountFile nameFull name
2ACC-00418823INV-3391.pdfGrace Hopper
3ACC-00977104Q3 forecast.xlsxAlan Turing

Common mistakes

  • Trailing spaces

    A cell that ends with a space returns that space as part of the result. Clean it first: RIGHT(TRIM(A2),4).

  • The result is text, not a number

    RIGHT(A2,4) returns "8823" as text, so it won't match a number in a lookup. Wrap it in VALUE when you need a real number.

  • Hardcoding a length for variable text

    RIGHT(B2,3) works for "pdf" but returns "lsx" for "xlsx". Calculate the length with LEN and FIND.

  • Names with more than two words

    RIGHT(A2,LEN(A2)-FIND(" ",A2)) finds the first space, so "Mary Jane Watson" returns "Jane Watson". In Microsoft 365, TEXTAFTER(A2," ",-1) takes the text after the last space.

FAQ

How do I get the last word in a cell?+

In Microsoft 365, use =TEXTAFTER(A2," ",-1). For a two-word name in any version, =RIGHT(A2,LEN(A2)-FIND(" ",A2)) works.

How do I remove the first few characters?+

Keep everything except them: =RIGHT(A2,LEN(A2)-4) drops the first four characters.

What if num_chars is bigger than the text?+

RIGHT returns the whole text, without an error.

Lesson

Master RIGHT step by step: LEFT, RIGHT, MID and LEN

Split product codes and IDs into their parts by taking characters from the start, end or middle of the text.

Related functions

LEFTMIDLENFIND