RIGHT Function Examples – Excel, VBA, & Google Sheets
Written by
Reviewed by
Download the example workbook
This tutorial demonstrates how to use the RIGHT Function in Excel and Google Sheets to return text from the end of a cell.
How to use the RIGHT Function in Excel:
The RIGHT Function extracts a specific number of characters from the RIGHT of a cell (or string of text).
This formula will extract 4 characters from the right of cell B3:
=RIGHT(B3,C3)
The second argument is optional and the default value of it is 1. Hence, it extracts 1 character from the RIGHT if omitted.
=RIGHT(B3)
RIGHT with FIND / SEARCH and LEN
In many scenarios, the number of characters to extract is dynamic. In these cases, you will often use the LEN and or FIND (or SEARCH) Functions.
Let’s look at this example to extract the last name.
=RIGHT(B3,LEN(B3)-FIND(" ",B3))
We use the FIND Function to find the space.
We use LEN to count the number of characters in the cell. Using this we can extract the required number of characters from the right.
You can also use the SEARCH Function instead of the FIND Function. The difference between FIND and SEARCH is that FIND is case sensitive.
=RIGHT(B3,LEN(B3)-SEARCH(" ",B3))
RIGHT with LEN
If you know how many characters you don’t want, but don’t know how many you do want, you can use the formula below. (In the example below, there are always 2 alphabetical characters in front. But the numbers differ.)
=RIGHT(B3,LEN(B3)-2)
An easier method is using the MID Function instead.
RIGHT with Number / Dates
RIGHT is a text function and the result will always be text. For instance, you won’t be able to sum up these numbers in cell E3 after using RIGHT.
To overcome the issues above, you can use VALUE to convert from text to values.
=VALUE(RIGHT(B3,LEN(B3)-LEN("Total Quantity: ")))
RIGHT in Google Sheets
The RIGHT Function works exactly the same in Google Sheets as in Excel:
RIGHT Examples in VBA
You can also use the RIGHT function in VBA. Type:
application.worksheetfunction.right(text,num_chars)
For the function arguments (text, etc.), you can either enter them directly into the function, or define variables to use instead.