Learn the Excel RIGHT function, interactively.
RIGHT returns the last num_chars characters of a text value. The mirror of LEFT, used for file extensions, last-4 card digits, email domains, timezones — anywhere the interesting piece is at the tail.
How to use RIGHT
- Type
=RIGHT(and supply the text — cell reference, literal, or any formula returning text. - Add a comma and num_chars — how many characters to take from the end. Defaults to
1when omitted. - Close the parenthesis. RIGHT returns text. Wrap with
VALUE()if you need a number. - For dynamic splits (everything after a specific delimiter), combine with
FIND/LENor useTEXTAFTERin Excel 365.
Try the presets — 4 pulls last-4 card digits, 3 grabs file extensions, 11 gets the right side of a composite ID.
1. 0 returns empty; N ≥ text length returns the full text, no error.| A | B | |
|---|---|---|
| 1 | Source | RIGHT (N=4) |
| 2 | quarterly-report.pdf | |
| 3 | 4111-1111-1111-4242 | 4242 |
| 4 | 2026-04-19T13:25:00Z | :00Z |
| 5 | ava@formulagym.com | .com |
| 6 | +1-415-555-2041 | 2041 |
| 7 | OK | OK |
=RIGHT(A2, 4). num_chars = 4: RIGHT returns the last 4 characters of each cell.RIGHT syntax and arguments
One required argument, one optional. See Microsoft’s official RIGHT / RIGHTB reference for the canonical specification.
1 when omitted. 0 returns an empty string; values ≥ the text length return the full text; negative values return #VALUE!.RIGHT examples
Four patterns that cover nearly every real-world RIGHT use.
Example 1: RIGHT for fixed-length tails
The canonical case — last 4 digits of a card, last 3 of a SKU.
4111-1111-1111-4242 → 4242. Works uniformly when every value has the same suffix length. For variable tails, use the FIND pattern below.
Example 2: RIGHT + FIND for file extensions
Extract everything after the last dot — regardless of how long the filename is.
LEN - FIND gives the count after the dot. For filenames with multiple dots (archive.tar.gz), the trick of finding the last dot is more involved — modern Excel has TEXTAFTER(A2, ".", -1) which handles it cleanly.
Example 3: RIGHT for email domain
Pull everything after the @ — the domain of an address.
Returns formulagym.com from ava@formulagym.com. Pair with COUNTIFS to group users by domain, or with SUBSTITUTE/TRIM if the source has trailing whitespace.
Example 4: RIGHT to get the last word
A classic trick pattern — works in every Excel version, though Excel 365’s TEXTAFTER is simpler.
SUBSTITUTE pads every space to 100 chars; RIGHT takes the last 100 (guaranteed to hold the last word plus padding); TRIM strips the padding. In Excel 365: =TEXTAFTER(A2, " ", -1).
Common RIGHT errors and fixes
Four failure modes, each with what to check and how to recover.
RIGHT returns #VALUE!
Cause: num_chars is negative, or the text argument evaluates to an error like #N/A.
Guard computed num_chars with MAX(0, ...). Wrap the whole expression in IFERROR to swallow upstream errors.
RIGHT numeric result won’t add
Cause: RIGHT always returns text, even on numeric strings. Arithmetic fails silently or coerces badly.
Wrap with VALUE(): =VALUE(RIGHT(A2, 4)). Or multiply by 1 for the shorter idiom.
RIGHT + FIND returns #VALUE! on missing delimiters
Cause: the delimiter isn’t in the source, so FIND errors and poisons the RIGHT call.
Wrap in IFERROR with a safe fallback: =IFERROR(RIGHT(A2, LEN(A2) - FIND(".", A2)), A2) returns the full text when there’s no dot.
RIGHT mis-counting on CJK text
Cause: in legacy DBCS Excel, some characters are 2 bytes; RIGHT counts characters while RIGHTB counts bytes.
In modern Unicode Excel (365 / 2021+), RIGHT is character-accurate. Use RIGHTB only when you need byte-level counting for interop with legacy systems.
RIGHT vs LEFT, MID & FIND
Four text-extraction tools. Pick based on which end you’re cutting from and whether the split point is fixed or dynamic.
| Function | Cuts from | Args | Typical use |
|---|---|---|---|
| RIGHT | End of string | text, [num_chars] | File extension, last N digits, email domain |
| LEFT | Start of string | text, [num_chars] | Prefix, country code, ISO year |
| MID | Arbitrary position | text, start_num, num_chars | Substring from the middle — month in ISO date |
| FIND | (locator, not extractor) | find_text, within_text, [start] | Pair with RIGHT/LEFT/MID to extract around a delimiter |
Rule of thumb: LEFT cuts from the front, RIGHT from the back, MID from anywhere. FIND / SEARCH locate positions to feed into any of them. In Excel 365, TEXTBEFORE and TEXTAFTER replace LEFT+FIND and RIGHT+FIND chains with cleaner single calls.
RIGHT frequently asked questions
6.01How do I extract a file extension with RIGHT?▸
Combine RIGHT with FIND: =RIGHT(A2, LEN(A2) - FIND(".", A2)). That returns everything after the first dot. For files with multiple dots (e.g. archive.tar.gz), replace FIND with a nested SUBSTITUTE/FIND pattern or use TEXTAFTER in modern Excel.
6.02What does RIGHT do when num_chars is bigger than the text?▸
It returns the entire string — RIGHT silently clamps num_chars to the length of the text, no error. Same safety behaviour as LEFT. That makes RIGHT safe on variable-length sources without a length check.
6.03How do I get the last word from a sentence?▸
Use =TRIM(RIGHT(SUBSTITUTE(A2, " ", REPT(" ", 100)), 100)). The trick: SUBSTITUTE pads every space to 100 chars, RIGHT takes the last 100 (guaranteed to hold only the last word plus padding), TRIM strips the padding. Ugly but works everywhere. In Excel 365, use TEXTAFTER(A2, " ", -1) — cleaner.
6.04Does RIGHT work on numbers?▸
Yes, but it coerces the number to text first and returns text. RIGHT(12345, 2) returns the string "45", not the number 45. Wrap with VALUE if you need a number for arithmetic.
6.05What’s the difference between RIGHT and RIGHTB?▸
RIGHT counts characters; RIGHTB counts bytes. On single-byte text they behave identically. On double-byte text (CJK, some emoji) RIGHTB reports length in bytes, which can split a character. In modern Unicode Excel, RIGHT is almost always what you want.
Microsoft Excel is a registered trademark of Microsoft Corporation. Google Sheets is a trademark of Google LLC. Formula Gym is not affiliated with, endorsed by, or sponsored by either company.