RIGHT Function Examples – Excel, VBA, & Google Sheets

Written by

Editorial Team

Reviewed by

Steve Rynearson

Last updated on February 9, 2023
Download Example Workbook

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.

RIGHT Formula Main

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)

PIC 01

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)

PIC 02

 

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))

PIC 03

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))

PIC 04

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)

PIC 05

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.

PIC 06

To overcome the issues above, you can use VALUE to convert from text to values.

=VALUE(RIGHT(B3,LEN(B3)-LEN("Total Quantity: ")))

PIC 08

RIGHT in Google Sheets

The RIGHT Function works exactly the same in Google Sheets as in Excel:

Right G Function

 

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.

AI Formula Generator

Try for Free

Excel Practice Worksheet

practice excel worksheet

Practice Excel functions and formulas with our 100% free practice worksheets!

  • Automatically Graded Exercises
  • Learn Excel, Inside Excel!

Free Download

Return to List of Excel Functions