Text
RIGHT Function in Excel
Returns the specified number of characters from the end of a text string.
Syntax
- =RIGHT(text, [num_chars])
Arguments
- text (required): The text string
- num_chars (optional): Number of characters to extract (default 1)
Examples
- =RIGHT("Hello World", 5) - Get last 5 characters - Result: World
- =RIGHT(A1, 4) - Extract file extension - Result: Last 4 chars
Excel RIGHT function documentation
- RIGHT returns the last num_chars characters from the end of a text string.
- Syntax: =RIGHT(text, [num_chars]). Omitted num_chars returns the last character only.
- Common for file extensions, last-N digits of IDs, and suffix extraction.
- Related: [LEFT](/functions/left/), [MID](/functions/mid/), [TEXTAFTER](/functions/textafter/).
RIGHT syntax and edge cases
- num_chars greater than string length returns the full string.
- RIGHT works on text; numeric cells are treated as text strings of digits.
- For variable suffix length use LEN minus FIND pattern or TEXTAFTER in M365.
- Pair with [VALUE](/functions/value/) when the extracted suffix must calculate as a number.
Step-by-step: extract file extension
- Step 1 — Filenames in column A: report.xlsx, data.csv.
- Step 2 — =RIGHT(A2, LEN(A2)-FIND(".", A2)) returns extension including the dot.
- Step 3 — Without dot: =RIGHT(A2, LEN(A2)-FIND(".", A2)) — refine with +1/-1 as needed.
- Step 4 — Fixed last 4 digits: =RIGHT(A2, 4) when IDs are zero-padded.
- Step 5 — M365 alternative: =TEXTAFTER(A2, ".") for extension without manual LEN math.
RIGHT vs MID vs TEXTAFTER
- RIGHT — fixed count from end; simplest for known suffix length.
- MID — extract middle segments when start position is known.
- TEXTAFTER — delimiter-based suffix in Excel 365.
- Guide: [LEFT vs MID vs RIGHT compare page](/compare/left-vs-mid-vs-right/).
Worked examples to copy
- Last 4 of card token: =RIGHT(A2, 4).
- Extension: =RIGHT(A2,5) when all extensions are 5 chars including dot.
- After last dash: combine with FIND from the right via nested formulas or TEXTAFTER.
- Audit: =RIGHT("00042", 3) returns "042" preserving leading zeros as text.
People also ask
- RIGHT function in Excel? — Returns characters from the right end of text.
- RIGHT to get extension? — Use RIGHT with LEN and FIND, or TEXTAFTER in M365.
- Does RIGHT work on dates? — Dates become serial text strings; usually use TEXT instead.
- RIGHT vs LEFT? — RIGHT takes from end; LEFT from start.
Common errors
- Returns full text if num_chars > text length
- #VALUE! if num_chars is negative
Use cases
- Extracting suffixes
- File extensions
- Code parsing
Frequently asked questions
- How do I extract the last N characters from text? Use =RIGHT(text, N). Example: =RIGHT("Hello", 3) returns "llo". If N exceeds text length, returns the entire text.
- How do I get everything after a specific character? Combine with FIND and LEN: =RIGHT(A1, LEN(A1)-FIND("@", A1)) extracts everything after @ in an email address.
- Can RIGHT extract numbers from text? RIGHT returns text. To get numbers, wrap in VALUE: =VALUE(RIGHT(A1, 4)) converts the last 4 characters to a number if they're numeric.
- How do I extract file extension? Use =RIGHT(A1, LEN(A1)-FIND(".", A1)) for simple cases. For multiple dots, use: =RIGHT(A1, LEN(A1)-FIND("~", SUBSTITUTE(A1,".","~",LEN(A1)-LEN(SUBSTITUTE(A1,".",""))))).
- What happens if num_chars is 0? RIGHT returns an empty string ("") when num_chars is 0. This is useful in formulas where the count might calculate to zero.
Editorial review
- Reviewed by Excel.Directory Editorial Team. Updated May 2026.
When to use RIGHT
- Extracting suffixes — common Text scenario for RIGHT.
- File extensions — common Text scenario for RIGHT.
- Code parsing — common Text scenario for RIGHT.
RIGHT in the Text category
- Browse all Text functions at /categories/text/ for related formulas.
- RIGHT syntax: =RIGHT(text, [num_chars])
- text (required): The text string
- num_chars (optional): Number of characters to extract (default 1)
- Confirm RIGHT arguments match the syntax shown above before filling down.
- Lock table and range references with $ when copying formulas across rows or sheets.
Formula checklist before you copy down
- Confirm RIGHT arguments match the syntax shown above before filling down.
- Lock table and range references with $ when copying formulas across rows or sheets.
- If results look wrong, check for text stored as numbers and invisible spaces with TRIM.
- Spot-check three known input rows manually against expected output.
Related Excel functions
- LEFT (/functions/left/): Returns the specified number of characters from the start of a text string.
- MID (/functions/mid/): Returns a specific number of characters from a text string, starting at a specified position.
- LEN (/functions/len/): Returns the number of characters in a text string.
- FIND (/functions/find/): Finds one text string within another and returns the starting position (case-sensitive).
Comparisons involving this function
- LEFT vs MID vs RIGHT (/compare/left-vs-mid-vs-right/): Use LEFT, MID, and RIGHT for fixed-position extraction. Use TEXTBEFORE, TEXTAFTER, and TEXTSPLIT in modern Excel when values are separated by a delimiter.
Errors to watch for
- Returns full text if num_chars > text length — review causes on linked error pages in the directory.
- #VALUE! if num_chars is negative — review causes on linked error pages in the directory.
Copy-paste audit workflow
- Enter RIGHT on three test rows with known expected output documented on a QA tab.
- Fill down only after absolute references are locked on lookup tables and rate tables.
- Compare against manual calculation or a calculator for financial and statistical functions.
- Search this directory for comparison guides when choosing between similar functions in the same category.
RIGHT worked examples to copy
- =RIGHT("Hello World", 5) — Get last 5 characters. Expected result: World.
- =RIGHT(A1, 4) — Extract file extension. Expected result: Last 4 chars.
RIGHT reference summary for crawlers and offline review
- RIGHT belongs to the Text category in Excel. Returns the specified number of characters from the end of a text string.
- Full syntax: =RIGHT(text, [num_chars]). Open /functions/right/ for parameters, FAQs, and related pages.
- Common mistakes: Returns full text if num_chars > text length; #VALUE! if num_chars is negative
- Pair this function with comparison guides when another Excel formula might fit the same task better.
- Review fix-excel-formula-errors when unexpected errors appear after upgrading Excel or sharing across locales.