The RIGHT function extracts a specified number of characters from the right side of a text string. This guide explains how RIGHT works and includes practical examples you can use immediately.
WHAT THE RIGHT FUNCTION DOES
RIGHT pulls characters from the end of a text string, making it ideal for extracting file extensions, suffixes, last names, or any fixed-length identifier that appears at the end of text. It's commonly used for parsing structured data or cleaning up imported text.
WHEN TO USE RIGHT
- You want to extract file extensions from filenames
- You need to get the last digits of account numbers or IDs
- You're extracting suffixes or domain names from email addresses
- You want to get the last few characters of any text string
FORMULA SYNTAX
RIGHT(text, num_chars)| Argument | Description |
|---|---|
text | The text string from which you want to extract characters |
num_chars | Number of characters to extract from the right |
EXAMPLE 1: EXTRACT FILE EXTENSIONS
We want to get the file extension from a list of filenames.
| A | B | |
|---|---|---|
| 1 | Filename | Extension |
| 2 | report.xlsx | =RIGHT(A2,4) |
| 3 | image.jpg | =RIGHT(A3,3) |
| 4 | data.csv | =RIGHT(A4,3) |
=RIGHT(A2, 4)Result: xlsx, jpg, csv (last characters including the dot)
Need help applying this? Try this in Numstro Builder
EXAMPLE 2: EXTRACT LAST 4 DIGITS OF ACCOUNT NUMBERS
We want to show only the last 4 digits for security purposes.
| A | B | |
|---|---|---|
| 1 | Account Number | Last 4 Digits |
| 2 | 1234567890 | =RIGHT(A2,4) |
| 3 | 9876543210 | =RIGHT(A3,4) |
| 4 | 5555444433 | =RIGHT(A4,4) |
=RIGHT(A2, 4)Result: 7890, 3210, 4433 (last 4 digits of each account number)
Need help applying this? Try this in Numstro Builder
COMMON MISTAKES & EDGE CASES
RELATED FUNCTIONS
FURTHER READING
Official Microsoft documentation:
RIGHT — Microsoft Support