RIGHT Function in Google Sheets
Returns the rightmost N characters of a string. The mirror of LEFT — used for file extensions, last names from a delimited string, suffixes, and quick parses.
Syntax
RIGHT(text, [number_of_chars])Returns: The rightmost number_of_chars characters of text.
Excel equivalent: RIGHT (identical)
Parameters
| Name | Required | Description |
|---|---|---|
| text | Required | The string to extract from. |
| number_of_chars | Optional | How many characters to return from the right. Default 1. |
Examples
File extension
=RIGHT(A2, 3)Returns last 3 chars — works for most file extensions like .png, .pdf, .csv.
Last 4 digits of a card number
=RIGHT(A2, 4)Masks all but the last 4 digits — common for credit card display.
Variable-length file extension
=RIGHT(A2, LEN(A2) - FIND(".", A2))Returns everything after the first dot. Handles extensions of any length.
When to use an alternative
- MID — You need characters from the middle, not the end.
- LEFT — You need characters from the start.
- REGEXEXTRACT — Your extraction is pattern-based.
Common errors and how to fix them
Returns shorter than expected
Cause: Source string is shorter than number_of_chars.
Fix: No error — RIGHT silently returns the whole string. Wrap with IF to detect.
Related functions
Frequently Asked Questions
How do I get the last word of a string?
Combine with FIND or RIGHT(text, LEN(text) - SEARCH("~", SUBSTITUTE(text, " ", "~", LEN(text) - LEN(SUBSTITUTE(text, " ", ""))))) — clunky. Easier with REGEXEXTRACT(text, "\\S+$") which returns the trailing non-whitespace run.
Can RIGHT handle multibyte characters correctly?
Yes — Sheets operates on code points, not bytes, so RIGHT works correctly for most unicode text.