fgFormula Gym
Interactive lesson · Excel & Google Sheets

Learn the Excel RIGHT function, interactively.

Last updated: April 2026

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.

01 · See it work

How to use RIGHT

  1. Type =RIGHT( and supply the text — cell reference, literal, or any formula returning text.
  2. Add a comma and num_chars — how many characters to take from the end. Defaults to 1 when omitted.
  3. Close the parenthesis. RIGHT returns text. Wrap with VALUE() if you need a number.
  4. For dynamic splits (everything after a specific delimiter), combine with FIND / LEN or use TEXTAFTER in Excel 365.

Try the presets — 4 pulls last-4 card digits, 3 grabs file extensions, 11 gets the right side of a composite ID.

FUNCTIONRIGHT
Returns the last N characters of a text value. Mirror of LEFT; silently clamps N to the string’s length — never errors on an over-long request.
ARG 1text
The source string. A cell reference, a literal, or any formula returning text. Numbers are coerced to text first.
ARG 2[num_chars]
How many characters to take from the right. Defaults to 1. 0 returns empty; N ≥ text length returns the full text, no error.
B2
fx
=RIGHT(A2, 4)
AB
1SourceRIGHT (N=4)
2quarterly-report.pdf.pdf
34111-1111-1111-42424242
42026-04-19T13:25:00Z:00Z
5ava@formulagym.com.com
6+1-415-555-20412041
7OKOK
B2 is the active cell — it holds =RIGHT(A2, 4). num_chars = 4: RIGHT returns the last 4 characters of each cell.
02 · Syntax, argument by argument

RIGHT syntax and arguments

One required argument, one optional. See Microsoft’s official RIGHT / RIGHTB reference for the canonical specification.

=RIGHT(text, [num_chars])
text
The source string. Cell reference, literal, or any formula that returns text. Numeric inputs are coerced to text using General formatting before extraction.
[num_chars]
Number of characters to take from the end. Defaults to1 when omitted. 0 returns an empty string; values ≥ the text length return the full text; negative values return #VALUE!.
03 · In the wild

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.

=RIGHT(A2, 4)

4111-1111-1111-42424242. 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.

=RIGHT(A2, LEN(A2) - FIND(".", A2))

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.

=RIGHT(A2, LEN(A2) - FIND("@", A2))

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.

=TRIM(RIGHT(SUBSTITUTE(A2, " ", REPT(" ", 100)), 100))

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).

04 · Errata

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.

05 · Kindred functions

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.

FunctionCuts fromArgsTypical use
RIGHTEnd of stringtext, [num_chars]File extension, last N digits, email domain
LEFTStart of stringtext, [num_chars]Prefix, country code, ISO year
MIDArbitrary positiontext, start_num, num_charsSubstring 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.

06 · Marginalia

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.