# RIGHT function in Excel

> RIGHT returns a set number of characters from the end of a text string.

Source: https://spreadsheetpractice.com/functions/right · Updated October 28, 2026 · Formulas and results on this page were run by the Spreadsheet Practice formula engine on November 20, 2026

## Quick answer

- **What it does:** RIGHT returns a set number of characters from the end of a text string.
- **Syntax:** `=RIGHT(text, [num_chars])`
- **Most common use:** `=RIGHT(A2,5)` returns 00418 (The last five characters, leading zeros intact)
- **Available in:** Every current version
- **Category:** [Text functions](https://spreadsheetpractice.com/functions/category/text)
- **Returns:** Text: the last num_chars characters, or the whole string if it is shorter than that.
- **Google Sheets:** Works the same in Google Sheets.

## What it does

RIGHT returns a set number of characters from the end of a text string. It's the quick way to grab the last digits of a phone or account number, a file extension, or the sequence number at the end of an ID.

## Syntax

`=RIGHT(text, [num_chars])`

| Argument | Required? | What it is |
|---|---|---|
| `text` | Required | The text or cell to read from. |
| `num_chars` | Optional | How many characters to return. Leave it out to get just the last character. |

## Examples

Each result was calculated by running the formula on the sample sheet.

| Cell | Formula | Result | What it shows |
|---|---|---|---|
| D2 | `=RIGHT(A2,5)` | 00418 | The last five characters, leading zeros intact |
| D3 | `=RIGHT(B3,4)` | 0193 | The last four digits of a phone number |
| D4 | `=RIGHT(C4,LEN(C4)-FIND(".",C4))` | docx | The file extension, whatever its length |

### The sample sheet

Every formula above runs on this data:

|  | A | B | C | D |
|---|---|---|---|---|
| 1 | Account | Phone | File | Result |
| 2 | ACCT-00418 | 612-555-0148 | q3-report.xlsx | 00418 |
| 3 | ACCT-01277 | 763-555-0193 | budget.csv | 0193 |
| 4 | ACCT-00093 | 952-555-0107 | notes.docx | docx |

## Common mistakes

| What you see | Why, and how to fix it |
|---|---|
| Blank or short results | Imported text often ends in spaces, so RIGHT returns them. Trim first: =RIGHT(TRIM(A2),4). |
| Leading zeros vanish when converted | RIGHT returns "00418" as text. VALUE turns it into 418, so leave it as text when the zeros matter. |
| Decimals come back oddly | RIGHT reads the stored value, not the display. A price shown as $5.50 is stored as 5.5, so =RIGHT(A2,2) returns ".5". Format it first: =RIGHT(TEXT(A2,"0.00"),2). |

## Tips

- Drop the first n characters with =RIGHT(A2,LEN(A2)-n).
- For the text after the last delimiter, =TEXTAFTER(A2,"-",-1) is simpler in Excel 2024 and Microsoft 365.

## Related functions

- [LEFT](https://spreadsheetpractice.com/functions/left): LEFT returns a set number of characters from the start of a text string.
- [MID](https://spreadsheetpractice.com/functions/mid): MID returns characters from the middle of a text string, starting at a position you choose.
- [TEXTAFTER](https://spreadsheetpractice.com/functions/textafter): TEXTAFTER returns everything after a delimiter, such as the domain after the @ or the last part of a file path.
- [LEN](https://spreadsheetpractice.com/functions/len): LEN counts the characters in a text string, including spaces and punctuation.

## Questions

### How do I get the last 4 digits in Excel?

Use =RIGHT(A2,4). The result is text, so wrap it in VALUE if you need to do math with it.

### How do I remove the last character in Excel?

Keep everything but the last character with LEFT: =LEFT(A2,LEN(A2)-1).

## Practice

A graded RIGHT exercise ("Sequence number") is on [the RIGHT page](https://spreadsheetpractice.com/functions/right). It is checked instantly, then re-checked on changed data.

Lessons that use RIGHT:

- [Lesson 18: LEFT, RIGHT, MID & LEN](https://spreadsheetpractice.com/learn/left-right-mid-len) (Pro)

---

Spreadsheet Practice (https://spreadsheetpractice.com) teaches spreadsheet formulas by practice: every exercise is graded in a live grid and re-checked on changed data.
