The RIGHT function in Excel extracts a specified number of characters from the end (right side) of a text string. It’s useful for pulling last names, extensions, suffixes, or any trailing portion of text—no add-ins or macros needed, just a basic Excel formula.
What You'll Need
- Microsoft Excel (any recent version: 2010, 2013, 2016, 2019, 2021, or Microsoft 365)
- A cell containing text you want to extract from (e.g., full name, product code, email address)
- Basic familiarity with typing formulas in the formula bar
Step-by-Step
- Open your Excel workbook and locate the cell with the text you want to modify—for example, cell A2 contains "John Smith".
- Click on the cell where you want the result to appear (e.g., B2).
- Type the formula
=RIGHT(A2, 5)into the formula bar (replace A2 with your source cell and 5 with the number of characters you want from the right). Press Enter. - Verify the result: "Smith" appears in B2 because "Smith" is the last 5 characters of "John Smith".
- To apply this to multiple rows, click the small square at the bottom-right corner of B2 (the fill handle) and drag it down to copy the formula to other cells—Excel automatically adjusts the row reference (e.g., A3, A4).
- If your text has inconsistent spacing (e.g., extra spaces after names), wrap the source cell in TRIM first:
=RIGHT(TRIM(A2), 5)to avoid counting spaces as characters. - For dynamic lengths, combine with LEN: if you need everything after the last space in a full name, use
=RIGHT(A2, LEN(A2)-FIND(" ",A2)). This finds the position of the first space, subtracts it from the total length, and extracts that many characters from the right.
Common Mistakes
- Using the wrong character count: If you want the last 3 characters but type 4, you’ll include an extra character (e.g., "mith" instead of "ith"). Double-check your count by manually counting from the end.
- Forgetting that spaces count as characters: " Smith" (with a leading space) is 6 characters, not 5. Use TRIM to clean up unintended spaces before applying RIGHT.
- Using RIGHT on numbers formatted as text: Excel may treat numbers like "00123" as text, but after applying RIGHT, leading zeros can disappear if the result is used in a numeric context. To preserve them, format the result cell as Text before entering the formula, or wrap the result in TEXT(value,"00000").
- Confusing RIGHT with LEFT or MID: RIGHT always pulls from the end; LEFT pulls from the beginning; MID pulls from a specific position. Confirm which direction you need.
- Text strings shorter than the requested length: If A2 contains "Ann" and you use
=RIGHT(A2,5), Excel returns "Ann" without error—but it’s not what you intended. Use IFERROR or LEN checks to guard against this.
Tips
- Combine RIGHT with FIND or SEARCH for variable-length extraction: For emails like "user@company.com", use
=RIGHT(A2, LEN(A2)-FIND("@",A2))to get the domain ("company.com"). - Use the Text to Columns feature as an alternative: Select your column > Data tab > Text to Columns > Delimited > Space > Finish. This splits names into separate columns, which may be more efficient than formulas if you need repeated reuse.
- Press F4 after typing a cell reference (e.g., A2) to toggle absolute references ($A$2) if you want to lock the source cell while dragging the formula across rows or columns.
- To extract everything except the last N characters, use
=LEFT(A2, LEN(A2)-N)instead of RIGHT—RIGHT always adds characters; it doesn’t subtract. - For phone numbers like "(555) 123-4567", use
=RIGHT(A2,10)to get the last 10 digits ("5551234567"), then clean with SUBSTITUTE if needed. - Test with a few sample rows first: Enter known values (e.g., "Test123"), verify your formula returns "123", then scale to your full dataset.
Troubleshooting
If your RIGHT formula returns unexpected results or errors, follow these steps:
- #VALUE! error: This usually means the num_chars argument is negative or non-numeric. Check that your second parameter is a positive number (e.g., 3, not -3) or a valid cell reference containing a number.
- Result is blank or too short: Confirm the source cell contains text—not a number or error. Press F2 in the source cell to see if Excel shows a leading/trailing space (indicated by a thin cursor gap before/after text). Use TRIM to fix.
- Formula shows as text instead of calculating: Ensure the cell isn’t formatted as Text. Right-click the cell > Format Cells > General or Number > OK. Then re-enter the formula.
- Leading zeros disappear (e.g., "007" becomes "7"): RIGHT always returns text, but Excel may auto-convert it to a number. Pre-format the output cell as Text before entering the formula, or use
=TEXT(RIGHT(A2,3),"000")to force three digits. - Copy-paste issues: If dragging the fill handle doesn’t update references, check if you accidentally locked the row/column (e.g., $A$2). Remove dollar signs or adjust them as needed.
Frequently Asked Questions
Can RIGHT handle Unicode characters like emojis?
Yes—RIGHT counts each Unicode character (including emojis) as one unit. For example, =RIGHT("Hello🌍",2) returns "lo🌍".
Does RIGHT work with dates?
No—dates in Excel are stored as serial numbers (e.g., 45000 for Jan 1, 2023). RIGHT("01/01/2023") treats it as text in display format only if the cell is formatted as Text. Otherwise, Excel converts the date to its number first, so RIGHT(A2,2) on a date cell may return "01" (from 45000) or an error. Convert dates to text first with =TEXT(A2,"mm/dd/yyyy"), then apply RIGHT.
How do I extract the last word from a sentence?
Use: =TRIM(RIGHT(SUBSTITUTE(A2," ",REPT(" ",100)),100)). This replaces spaces with 100 spaces, then RIGHT grabs the last 100 characters (containing only the last word), and TRIM cleans it up.
Can I use RIGHT with wildcards like * or ?
No—RIGHT is a text-extraction function, not a search function. Wildcards work in functions like SEARCH or VLOOKUP, but RIGHT ignores them. For pattern-based extraction, combine with FIND or use Power Query.
Why does RIGHT(A2,LEN(A2)) return the whole string?
Because LEN(A2) gives the total character count. Extracting that many characters from the right returns the full string. This is correct behavior—if you want to duplicate the text, it’s valid; otherwise, reduce the count (e.g., LEN(A2)-1 to drop the first character).
Does RIGHT work in Excel Online and mobile apps?
Yes—RIGHT is a core Excel function supported in Excel for the web, iOS, and Android. However, complex nested formulas may require more careful formatting on mobile due to smaller screens.