**RIGHT Function in Excel (Table of Contents)**

## RIGHT Function in Excel

Right function in excel, which is used to extract the cell values starting from the extreme right. We can also select the number of characters which we need to extract from the selected cell. This is quite helpful in extracting some portion of the text. For example, if a cell contains FIRST and if we want to use the Right function here considering 3 characters to be extracted, we will be getting RST starting from right as output.

**RIGHT Formula in Excel:**

Below is the RIGHT Formula in Excel.

**Explanation of RIGHT Function in Excel:**

A RIGHT Formula in excel has two parameters: i.e. text, num_chars.

**text:**From the text that you want to extract specified characters.**[num_chars]:**This is an optional parameter. The number of characters you want to extract from the given text**.**If you do not give any numbers by default, it will give you only one character.

Usually, a RIGHT function in excel is used alongside other text functions like SEARCH, REPLACE, LEN, FIND, LEFT, etc…

### How to Use RIGHT Function in Excel?

RIGHT Function in Excel is very simple and easy to use. Let us understand the working of the RIGHT function in Excel by some RIGHT Formula example. A RIGHT function can be used as a worksheet function and as a VBA function.

#### Example #1

Look at the below data that contains invoice numbers. You need to extract the last 4 digits of all the invoice numbers using the RIGHT function in Excel.

We can extract the last 4 digits of the above text by using the RIGHT function in Excel.** **

So the result will be :

#### Example #2

Assume you have serial numbers from A1 to A10, and you need to extract 6 characters from the right.

A RIGHT function will return the last 6 digits from the right end of the text.

Result is :

#### Example #3

Below are the names of the employees, and you need to extract the Last Name separately.

In the above example, we cannot just apply RIGHT with specified numbers because the last name of every employee is different. For the first employee last 4 characters are 5, but for the second on it is 11 (including space, i.e. Robort Adam), and for the third one, it is 12 (including space, i.e. J. Johnston). Here we need to use LEN & FIND function to determine the number of characters from the given text.

So the result will be :

**Part 1: **This part determines the desired text that you want to extract the characters.

**Part 2: **LEN function will give you the total number of characters in the list. We will see the detailed article on LEN in the upcoming articles.

Result is :

**Part 3: **The FIND function determines from which number space begins, i.e. The End of the first name. We will see the detailed article on FIND in the upcoming articles.

Result is :

Len gives 10 characters, and find gives 5 characters for the first employee. That means LEN – FIND (10 – 5) = 5 character from the right side.

16 Online Courses | 23 Hands-on Projects| 140+ Hours| Verifiable Certificate of Completion

4.8

View Course

The result will be Smith**.**

Len gives 16 characters, and find gives 5 characters for the first employee. That means LEN – FIND (16 – 5) = 11 characters from the right side.

The result will be Robort Adam.

Len gives 17 characters, and find gives 5 characters for the first employee. That means LEN – FIND (17 – 5) = 12 characters from the right side.

The result will be J. Johsnston.

**NOTE:**Space is also considered as one character.

#### Example #4

Let us consider the same example from the above. Names of the employees, and you need to extract the Last Name separately. i.e. only ADAM, not ROBORT ADAM.

This is done by using LEN, FIND and SUBSTITUTE formula alongside the RIGHT function in Excel.

The first SUBSTITUTE function will replace the space **(“ “)** with **“#” **and then LEN, a function will deduct the space character number from the SUBSTITUTE function to get only the last name characters.

So the result will be :

#### Example #5

From the below table, extract the last number until you find a space.

This is a bit of complex data, but we can still extract the last characters by using the RIGHT Function in Excel and the FIND function.

So the result will be :

**Part 1: **This part determines the desired text that you want to extract the characters.

**Part 2: **LEN function will give you the total number of characters in the list.

**Part 3: **FIND function determines from which number “**@”** begins.

#### Example #6

Below are the errors find out while you are working on the web-based software. You need to extract substring after the last occurrence of the delimiter.

This can be done by the combination of LEN, SEARCH & SUBSTITUTE along with the RIGHT function in Excel.

- The first step is to calculate the total length of the string using the LEN function: LEN(A2)
- The second step is to calculate the length of the string without delimiters by using the SUBSTITUTE function that replaces all occurrences of a colon with nothing: LEN(SUBSTITUTE(A2,”:”,””))
- Lastly, we subtract the length of the original string without delimiters from the total string length: LEN(A2)-LEN(SUBSTITUTE(A2,”:”,””))

So the result would be:

#### Example #7

RIGHT Function in Excel does not work with Dates. Since the RIGHT function is text a function, it can extract numbers too, but it does not work with dates. Assume you have a date in cell A1 “22-Oct-18”

Then we’ll try to extract the year with the formula.

The result would be 3395.

In excel, ideology 3395 means 2018 if the format is in Dates. So RIGHT function in Excel will not recognize it as a date but as usual as a number only.

### VBA RIGHT Function

In VBA, also we can use the RIGHT function. Below is a simple illustration of the VBA right function.

If you run the above code, it will give you the below result.

### Things to Remember

- Number formatting is not part of a string and will not be extracted or counted.
- Right Function in Excel is designed to extract the characters from the right side of a specified text.
- If the user does not specify the last parameter, it will take 1 as by default.
- Num_chars must be greater than or equal to zero. If it is a negative number, it will throw the error as #VALUE.
- A RIGHT function will not give accurate results in case of date formatting.
- In the case of complex data sets, you need to use other text functions like LEN, SEARCH, FIND, and SUBSTITUTE to get the Num_chars parameter.

### Recommended Articles

This has been a guide to the RIGHT Function in Excel. Here we discuss the RIGHT Formula in Excel and How to use the RIGHT Function in Excel, along with practical examples and a downloadable excel template. You can also go through our other suggested articles –