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)
ArgumentDescription
textThe text string from which you want to extract characters
num_charsNumber of characters to extract from the right
EXAMPLE 1: EXTRACT FILE EXTENSIONS

We want to get the file extension from a list of filenames.

AB
1FilenameExtension
2report.xlsx=RIGHT(A2,4)
3image.jpg=RIGHT(A3,3)
4data.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.

AB
1Account NumberLast 4 Digits
21234567890=RIGHT(A2,4)
39876543210=RIGHT(A3,4)
45555444433=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
  • If num_chars exceeds the text length, RIGHT returns the entire string
  • If num_chars is 0, RIGHT returns an empty string
  • Negative num_chars will cause a #VALUE! error
  • RIGHT counts spaces and special characters as characters
  • For dynamic extraction based on delimiters, combine with FIND or LEN
RELATED FUNCTIONS
  • LEFT — extract characters from the left side
  • MID — extract characters from the middle
  • LEN — get the total length of text
  • FIND — locate specific characters for dynamic extraction
FURTHER READING

Official Microsoft documentation:
RIGHT — Microsoft Support