What RIGHT does

RIGHT returns the last characters of a text, as many as you ask for. =RIGHT(A2,4) takes the last four characters of the invoice number INV-2026-0147 and returns 0147, its running number. From a code like UK-4471-B, =RIGHT(A2,1) returns the version letter B.

Counting from the end is useful because the end of a code is often the part that changes, while the start is a fixed prefix. With LEN, RIGHT can also keep everything except the first few characters, whatever the length of the text.

RIGHT returns text, which is why 0147 keeps its leading zero. As text it’s four characters; as a number it would be 147.

Syntax

=RIGHT(text, [num_chars])
Arguments in square brackets are optional; the rest are required.
textRequired
The text to take characters from, usually a cell such as A2.
num_charsOptional
How many characters to take from the end. Leave it out and RIGHT takes 1. It can be a calculation, such as LEN(A2)-4 for everything after the first four characters.

Example: the running number from an invoice number

The last four characters of each invoice number are its running number. The formula in B2 is filled down to B4.

The results are text, so the leading zeros stay. In B2, =RIGHT(A2,4) returns 0147.

Example: everything after a prefix

The codes start with “SKU-” and the numbers after it have different lengths. LEN gives the full length; take away the 4 characters of the prefix and RIGHT keeps the rest.

SKU-48812 has 9 characters; 9 - 4 = 5, so RIGHT keeps the last 5. In B2, =RIGHT(A2,LEN(A2)-4) returns 48812.

Text after a specific character

When the part you want follows a separator, work out how many characters come after it. LEN gives the full length and FIND the position of the separator, so the difference is the count RIGHT needs:

  • The domain in an email address: =RIGHT(A2,LEN(A2)-FIND("@",A2)) returns example.com from ana.silva@example.com.
  • Everything after the first dash in UK-4471-B: =RIGHT(A2,LEN(A2)-FIND("-",A2)) returns 4471-B.

In Microsoft 365 and Excel 2024, TEXTAFTER does this in one step, and it can count from the last dash instead of the first: =TEXTAFTER(A2,"-",-1) returns B.

Common mistakes

  • “INV-2026-0147 ” with a space at the end gives “147 ”. Clean the text first with TRIM: =RIGHT(TRIM(A2),4).
  • The result is text, so it won’t add up or match a number in a lookup. =VALUE(RIGHT(A2,4)) turns it into the number 147.
  • =RIGHT(A2,5) on codes with 4- to 6-digit numbers takes too much or too little. Work the count out with LEN, or from the position of a separator with FIND.
  • RIGHT on a date works on the date’s serial number, so =RIGHT(A2,4) for Mar 15, 2026 returns “6096”. Use YEAR to get the year of a date.

Frequently asked questions

How do I extract text after a character in Excel?

Subtract the character’s position from the length: =RIGHT(A2,LEN(A2)-FIND("-",A2)) keeps everything after the first dash. In Microsoft 365 and Excel 2024, =TEXTAFTER(A2,"-") gives the same result.

How do I use RIGHT to remove the first characters?

Subtract the number of characters you want to drop from the length: =RIGHT(A2,LEN(A2)-4) removes the first four characters, however long the rest is.

How do I remove the last characters instead?

Use LEFT with LEN: =LEFT(A2,LEN(A2)-2) drops the last two characters.

What if num_chars is bigger than the text?

RIGHT returns the whole text, without an error.

Why is my RIGHT formula not working?

Look for a space at the end of the text. RIGHT counts it as the last character, so “INV-2026-0147 ” gives “147 ” until you clean it with TRIM. A date can also surprise you, because RIGHT works on its serial number: for Mar 15, 2026, =RIGHT(A2,4) returns 6096.