The RIGHT function in Google Sheets is a tool that extracts a specified number of characters from the end of a text string. It's perfect for tasks like isolating suffixes, extracting the last digits of IDs, or organizing structured data.
How It Works
The RIGHT function operates by counting characters from the end of a text string and returning only the portion you specify.
- Pull characters starting from the end of the string.
- Choose how many characters to extract using the num_chars parameter.
- If num_chars is omitted, it extracts the last character only.
- Works with text, numbers, or mixed data in a cell.
1. Key Applications
1. Extracting Suffixes:
- Use
RIGHTto pull out file extensions (e.g.,.pdfor.docx) or name suffixes (e.g., "Jr." or "III"). - Example:
=RIGHT(A1, 3)extracts the last three characters from the text in cell A1.
2. Isolating Specific Digits:
- Extract the last few digits from codes or numbers, like serial numbers or phone extensions.
- Example:
=RIGHT("123456789", 4)returns6789.
3. Cleaning and Formatting Text Data:
- Remove unwanted prefixes or isolate relevant portions of a text string.
- Example: For a string like "INV-2023",
=RIGHT(A1, 4)extracts "2023".
The RIGHT function simplifies text manipulation in Google Sheets, making it useful for a variety of data management tasks.
2. RIGHT Function Syntax in Google Sheets
=RIGHT(text, [num_chars])
Parameters:
- text: (Required) The text or cell reference from which to extract characters.
- num_chars: (Optional) The number of characters to extract from the end. If omitted, it defaults to 1.
3. How to Use RIGHT Formula in Google Sheets
Learn how to easily extract characters from the end of text with the RIGHT function in Google Sheets.
Step 1: Set Up the Data and Select a Cell
Create a table with sample data and select a cell to enter the formula.

Step 2: Write the Formula
In a new column (e.g., Column C), use the RIGHT function to extract the last 3 digits of the Product Code. Enter the formula in cell C2:
=RIGHT(B2, 3)

Step 3: Drag the Formula Down
Click and drag the fill handle (bottom-right corner of C2) to apply the formula to the rest of the rows.

Step 4: Interpret the Results
The new column will display the last 3 characters of each Product Code:

4. Combining the RIGHT Function with Other Functions
The RIGHT function can be combined with other Google Sheets functions to perform advanced text manipulations and extractions. Here are some practical examples:
1. RIGHT + CONCATENATE
Combine extracted text with another string or value.
Formula Example:
=CONCATENATE(RIGHT(A1, 2), B1)
- Purpose: Extract the last two characters from
A1and combine them with the value inB1. - Use Case: Create custom IDs or labels like "23-XYZ".
2. RIGHT + LEN
Dynamically extract characters by using the length of the string.
Formula Example:
=RIGHT(A1, LEN(A1)-3)
- Purpose: Extract all characters from the string in
A1except the first three. - Use Case: Remove prefixes from product codes like changing "INV2023" to "2023".
3. RIGHT + FIND
Extract text after a specific delimiter like a dash (-).
Formula Example:
=RIGHT(A1, LEN(A1)-FIND("-", A1))
- Purpose: Extract text following a dash (
-) inA1. - Use Case: For "ABC-123", it returns "123". Useful for separating categories or IDs.
By combining the RIGHT function with other functions like CONCATENATE, LEN, and FIND, you can create flexible formulas for text manipulation and data cleaning.
5. Advanced Use Cases of the RIGHT Function
The RIGHT function becomes even more powerful when applied in advanced scenarios for dynamic text extraction and data cleaning. Here’s how you can use it:
1. Dynamic Text Extraction
- Combine the RIGHT function with ARRAYFORMULA to process multiple rows of data at once.
Formula Example:
=ARRAYFORMULA(RIGHT(A1:A10, 3))
- Purpose: Extract the last three characters from each cell in the range
A1:A10. - Use Case: Useful for handling bulk data, such as extracting extensions like
.csvor.jpgfrom a list of filenames.
2. Data Cleaning
- Use RIGHT to remove unwanted characters and extract clean data for analysis or formatting.
Formula Example:
=RIGHT(A1, LEN(A1)-3)
- Purpose: Removes the first three characters from the text in
A1. - Use Case: Clean up product IDs like converting "INV123" to "123" by removing the prefix.
These advanced use cases make the RIGHT function a versatile tool for dynamic data extraction and efficient data cleaning, especially when working with large datasets in Google Sheets.
6. Common Errors and Troubleshooting for the RIGHT Function
| Error | Cause | Solution |
|---|---|---|
| Incorrect Output for Numbers | Numbers are treated as numeric values instead of text. | Format numbers as text before applying the RIGHT function. Use TEXT(A1, "0") if necessary. |
| Output Includes Unwanted Characters | Data contains extra spaces or unwanted symbols. | Use functions like TRIM to remove spaces or SUBSTITUTE to replace unwanted characters. Example: =TRIM(SUBSTITUTE(A1, "-", "")). |
| #VALUE! Error | Argument is not valid or contains blank cells. | Ensure the referenced cell is not empty and contains valid text or numeric data. |
| Mismatched Length in Output | Trying to extract more characters than available. | Double-check the number of characters specified in the RIGHT function. Use LEN(A1) to confirm string length. |
By addressing these common errors, you can ensure accurate results when using the RIGHT function in Google Sheets.
Also Read: