RIGHT - Excel & Sheets
Master the RIGHT function to extract characters from text end. Learn syntax, examples, and solutions for text manipulation in Excel and Google Sheets.




=RIGHT(text, [num_chars])
Practical Examples
Extract File Extensions
Get file extensions from a list of filenames
Extract Last 4 Digits of Account Number
Get the last 4 digits for security display purposes
Extract Year from Date Text
Get the year portion from dates stored as text
Dynamic Extension Extraction
Extract variable-length file extensions using SEARCH
Extract Product Category Codes
Get category codes from standardized product IDs
Phone Number Area Code
Extract the last 4 digits of phone numbers
Common Errors and Solutions
RIGHT returns #VALUE! error
The num_chars argument is negative or not a valid number
1. Check that num_chars is positive or zero 2. Ensure num_chars is a number, not text 3. Use ABS() function if the value might be negative 4. Verify cell references are pointing to numeric values
Always validate that num_chars is a positive number. Use data validation or MAX(0, num_chars) to ensure non-negative values.
Example:
Formula returns more or fewer characters than expected
Hidden spaces, non-printing characters, or incorrect character count
1. Use TRIM to remove extra spaces: =RIGHT(TRIM(A1), 3) 2. Use CLEAN to remove non-printing characters 3. Check the actual string length with LEN function 4. View formulas to see actual cell contents
Always clean your data first with TRIM and CLEAN functions when working with imported or user-entered text.
Example:
Excel doesn't recognize the function name
Misspelled function name or using RIGHT as a variable name
1. Check spelling - it should be RIGHT, not RIGTH or RIGHT() 2. Ensure you're not using 'Right' (Excel functions are not case-sensitive, but check for typos) 3. Verify the function is available in your Excel version 4. Check if the worksheet is in R1C1 reference style
Use Excel's Formula AutoComplete feature to ensure correct function names.
Example:
RIGHT returns empty string when expecting data
Source cell is empty, num_chars is 0, or formula references wrong cell
1. Check if source cell contains data using ISBLANK 2. Verify num_chars is greater than 0 3. Use IF statement to handle empty cells 4. Trace formula precedents to verify references
Implement error checking: =IF(LEN(A1)>0, RIGHT(A1, 3), "No data")
Example:
Best Practices and Advanced Tips
Use LEN and SEARCH together with RIGHT for dynamic extraction. For example, to get everything after the last space: =RIGHT(A1, LEN(A1) - SEARCH("~", SUBSTITUTE(A1, " ", "~", LEN(A1)-LEN(SUBSTITUTE(A1, " ", ""))))). This finds the position of the last occurrence of any character.
Always wrap RIGHT in IFERROR when working with unpredictable data: =IFERROR(RIGHT(A1, 3), "Error"). This prevents errors from propagating through your spreadsheet and provides meaningful fallback values.
RIGHT counts characters, not bytes. Unicode characters (emojis, special symbols) count as one character each. Be aware when working with international data or special characters that visual width doesn't equal character count.
For large datasets, avoid using RIGHT within array formulas unnecessarily. Pre-calculate the num_chars value in a helper column if it requires complex calculation. This can improve recalculation speed by up to 40% on sheets with thousands of rows.
For one-time extractions, consider using Data > Text to Columns with fixed width or delimiter options instead of formulas. This is faster for large datasets but doesn't update automatically. RIGHT is better for dynamic data that changes frequently.
When using RIGHT on numbers, Excel automatically converts them to text. To maintain number format after extraction, wrap the result in VALUE(): =VALUE(RIGHT(A1, 3)). This is crucial when you need to perform calculations on the extracted portion.
Need Help with RIGHT - Excel & Sheets?
Stop struggling with formula syntax. Use AskFormulas to generate validated formulas instantly with our AI-powered tool.
Example Excel formula:
Related Formulas
Extract text from the beginning of strings with the LEFT function. Learn syntax, examples, and error solutions for Excel and Google Sheets.

Master the LEN function to count characters in text strings. Learn data validation, text analysis, and formatting in Excel and Google Sheets.

Master the MID function to extract text from any position. Learn syntax, examples, and solutions to common errors for precise text manipulation.

Master the SEARCH function to find text within strings. Learn case-insensitive searching, wildcards, practical examples, and error solutions.
