Skip to content

Excel function · Text

Excel RIGHT function

RIGHT returns the number of characters you ask for from the end of a text: the sequence part of an invoice number, the colour suffix of a product code, the surname from a full name.

In Turkish Excel: SAĞDAN

What it does

RIGHT is the mirror image of LEFT: it starts counting at the last character and returns as many characters as you ask for, in their original order. When the end of a code has a fixed length (the last four digits, a two-letter colour suffix), RIGHT is all you need.

When the last part varies in length, calculate the number of characters: take the total length with LEN and subtract the position of the delimiter found with FIND. =RIGHT(A2,LEN(A2)-FIND(" ",A2)) returns everything after the first space.

In Microsoft 365, TEXTAFTER does the same with less typing and can find the last delimiter directly. For a part at the start or in the middle, use LEFT or MID.

Syntax

English Excel=RIGHT(text, [num_chars])
Turkish Excel=SAĞDAN(metin; [karakter_sayısı])

Arguments in square brackets are optional. English Excel separates arguments with commas (,) and uses a dot for decimals; Turkish Excel uses semicolons (;) and a decimal comma. Excel shows function names in its own language when it opens the file.

Arguments

ArgumentRequiredDescription
textRequiredThe text to take characters from, or a cell. For numbers, the stored value is used, not the cell's formatting: a cell showing 1,250.00 holds 1250.
num_charsOptionalHow many characters to take from the end. If omitted, 1; if larger than the text, the whole text is returned. It cannot be negative.

Examples

1Get the sequence number from an invoice number

The last four digits of each invoice number are its sequence number. All numbers have the same length, so =RIGHT(A2,4) is enough.

C2fx=RIGHT(A2,4)
Get the sequence number from an invoice number: example table
ABC
1Invoice NoCustomerSequence
2INV-2025-0042Brown & Sons0042
3INV-2025-0043Northgate Ltd0043
4INV-2025-0117Harbour Trade0117
5INV-2025-0118Star Market0118
  • C2 (filled down to C5)=RIGHT(A2,4)

C2 shows 0042; the result is text, so the leading zeros stay. To calculate with the sequence numbers, use =--RIGHT(A2,4).

We recalculated this example in real Excel (Microsoft 365, 16.0) and compared the results: they match.

2Take everything after the first space

The number of characters to take is the length of the text minus the position of the space, so every row returns all characters after the first space.

B2fx=RIGHT(A2,LEN(A2)-FIND(" ",A2))
Take everything after the first space: example table
AB
1Full NameSurname
2Emma BrownBrown
3Mary Ann ClarkAnn Clark
4Lucas GrayGray
5Ava ThompsonThompson
  • B2 (filled down to B5)=RIGHT(A2,LEN(A2)-FIND(" ",A2))

B2 shows Brown. With two first names, the part after the first space has two words: B3 shows Ann Clark. The formula in the next example handles this case.

We recalculated this example in real Excel (Microsoft 365, 16.0) and compared the results: they match.

3Always get the last word

Each space is turned into 100 spaces with REPT; the last 100 characters then hold only the last word and some spaces, and TRIM removes the spaces.

B2fx=TRIM(RIGHT(SUBSTITUTE(A2," ",REPT(" ",100)),100))
Always get the last word: example table
AB
1Full NameSurname
2Emma BrownBrown
3Mary Ann ClarkClark
4Sophia Rose HallHall
5Lucas GrayGray
  • B2 (filled down to B5)=TRIM(RIGHT(SUBSTITUTE(A2," ",REPT(" ",100)),100))

B3 now shows Clark and B4 shows Hall. In Microsoft 365, =TEXTAFTER(A2," ",-1) gives the same result.

We recalculated this example in real Excel (Microsoft 365, 16.0) and compared the results: they match.

Common errors and fixes

#VALUE!

Cause: num_chars is negative, or the FIND that calculates it did not find the delimiter.

Fix: Make sure every row contains the delimiter, or wrap the formula in IFERROR.

Missing character

Cause: The cell ends with an invisible space; RIGHT counts it first, so =RIGHT(A2,4) returns three digits and a space.

Fix: Clean the text with TRIM first: =RIGHT(TRIM(A2),4).

Good to know

  • RIGHT returns text. To calculate with sequence numbers such as "0042", use =--RIGHT(A2,4).
  • For the part after the last delimiter, such as a file extension, =TEXTAFTER(A2,".",-1) is the shortest route in Microsoft 365.

In Nexell

Get Nexell to do it from a sentence

Type this in Nexell

Copy the last four digits of each invoice number into a new Sequence column

Convert to table

Bring your invoice list into the tool and type this. Nexell builds the new column with a real Excel text formula and shows it in the preview first; the formula stays live in the downloaded file.

Nexell uses AI to understand the request and builds the result with real Excel formulas; the formula may differ from the example on this page. You see a preview first and nothing changes until you press Apply; formulas stay live in the downloaded .xlsx file.

Free account · no card needed · 30 credits a month

Frequently asked questions

How do I get the last word with RIGHT?

In Microsoft 365, use =TEXTAFTER(A2," ",-1). In older versions the well-known trick is to replace every space with 100 spaces, take the last 100 characters and trim them: =TRIM(RIGHT(SUBSTITUTE(A2," ",REPT(" ",100)),100)).

Can RIGHT and LEFT be combined?

Yes. For example, =LEFT(RIGHT(A2,7),3) returns the first three of the last seven characters. For a part in the middle, MID is usually easier to read.

Related functions

All text functions →

Stop memorising formulas. Describe them.

Bring your table into the tool and say what you need; Nexell builds the formula and shows it in a preview.

Try it free