RIGHT Function in Excel, Google Sheets, Airtable & Notion
RIGHT returns a set number of characters from the end of a text string. RIGHT("INV-2024-0042", 4) is “0042”.
Syntax in each app
| App | Support | Syntax & notes |
|---|---|---|
| Excel | ✔ Built in | RIGHT(text, [num_chars])num_chars defaults to 1. |
| Google Sheets | ✔ Built in | RIGHT(string, [number_of_characters]) |
| Airtable | ✔ Built in | RIGHT(string, howMany) |
| Notion | ≈ Workaround | substring(text, max(length(text) - n, 0), length(text))No RIGHT in Notion. Start n characters before the end; max(…, 0) stops the start going negative when n is longer than the text. |
| Excel | =RIGHT("INV-2024-0042", 4) | open excel.new ↗ |
|---|---|---|
| Google Sheets | =RIGHT("INV-2024-0042", 4) | open sheets.new ↗ |
| Airtable | RIGHT("INV-2024-0042", 4) | |
| Notion workaround | substring("INV-2024-0042", max(length("INV-2024-0042") - 4, 0), length("INV-2024-0042")) |
Excel & Sheets use cell ranges. Paste this sample data into cell A1 of a blank sheet, then paste the formula into any empty cell.
Arguments
| Argument | What it means |
|---|---|
text | The text to take characters from. |
[num_chars] optional | How many characters to return from the end. Defaults to 1; negative is #VALUE!. |
Examples
| Formula | Result | Why | Copy |
|---|---|---|---|
=RIGHT("INV-2024-0042", 4) | 0042 | Leading zeros are kept because the result is text. | |
=RIGHT(A2, LEN(A2) - FIND(" ", A2)) | Last name | Everything after the first space. | |
="**** "&RIGHT("4111222233334444", 4) | **** 4444 | Mask all but the last four digits. | |
=RIGHT("Report.xlsx", 5) | .xlsx | A file extension. |
Examples use Excel / Google Sheets syntax unless noted.
How RIGHT works
RIGHT is the mirror of LEFT. Use it for suffixes: the last 4 digits of an account number, a file extension, the check digit of a code. When the part you want is variable length, work out its length first: =RIGHT(A2, LEN(A2) - FIND("-", A2)) keeps everything after the first dash.
Like LEFT, RIGHT returns text, so “0042” keeps its leading zeros, which is often what you want for IDs. Applied to a number, it works on the digits as they are stored, not as they are formatted: =RIGHT(1234.5, 2) is “.5”, and a currency-formatted cell won't include the $ sign.
Airtable's RIGHT(string, howMany) behaves the same way. Notion has no RIGHT; the equivalent is a substring() that starts n characters before length(text). Notion positions start at 0 and the end position is exclusive.
Frequently Asked Questions
- How do I get the text after the last dash or slash?
- In Excel 365 use
=TEXTAFTER(A2, "-", -1). Elsewhere use regex extraction (REGEXEXTRACT(A2, "[^-]*$")in Google Sheets,REGEX_EXTRACTin Airtable).