The Excel RIGHT Function: What It Is and How It Works

By Indeed Editorial Team

Published April 14, 2022

The Indeed Editorial Team comprises a diverse and talented team of writers, researchers and subject matter experts equipped with Indeed's data and insights to deliver useful tips to help guide your career journey.

If you use Excel in the workplace, you may be interested in learning about certain techniques you can apply to this program. One of these helpful techniques is the RIGHT function. Using this function can make it easier to pull out characters that begin from the rightmost side and place them to the left. In this article, we explore what the Excel RIGHT function is, how it works, how to implement this technique when using the program and examples of this function.

What is the Excel RIGHT function?

The Excel RIGHT function is a text string that provides how many characters are on the right side of a string. This function allows users to return the last characters in a text string, depending on how many characters they specify. It also pulls out characters that begin on the rightmost side of the left side of the Excel sheet. Using this function makes it easier to identify characters and move them to the right side when needed.

Related: How To Include Excel Skills on Your Resume

How does the Excel RIGHT function work?

The RIGHT function works by returning a certain number of characters from the bottom of a text string. The syntax for the RIGHT function is as follows:

RIGHT(text, [num_chars])

Within this syntax, the text is a required element and refers to the text string from which you want to pull characters. The num_chars element is optional and provides the code with the number of characters extracted. The default number for the nums_chars code is one. This means that if you don't include a value for this code, the RIGHT function extracts the last letter of a text string. If the value of the nums_chars code is larger than the original text, it extracts the entire text.

The RIGHT function will always bring back a text string, no matter what the current value is. For example, if the current value is a number, the code will still produce a text string rather than a number string. For this reason, you may only want to use text when working with this function. Otherwise, it may return incorrect values of the numbers in the form of text.

How to use the RIGHT function in Excel

The following are steps and formulas to help you use the RIGHT function in Excel in relation to three different uses for this function:

1. Get a substring that follows a specified character

If you want to find and extract a specific character from a text string or substring, you can use either the FIND or SEARCH element to see where the character is located. You can then remove the character from the string by returning it with the LEN function. This allows you to extract the specific character from the right side of the first string. The code you can use when implementing this function is as follows:

RIGHT(string, LEN(string) - SEARCH(character, string))

You can also use this function to develop a substring that comes after other characters, such as semicolons or commas. If you want to do so, you can use the following code:

=RIGHT(A2,LEN(A2)-SEARCH("-",A2))

Related: Basic Excel Formulas and How To Use Them

2. Extract a substring from the last appearance of a delimiter

You may use this function to extract a text string from more complicated strings, such as characters that occur at various times within the same delimiter. This may require you to pull the text located to the right of the last occurrence of the delimiter. Here are the steps you can follow to do so:

  1. Pull the number of delimiters located in the original string using the LEN function.

  2. Determine the length of the text string with no delimiters with the SUBSTITUTE function.

  3. Subtract the total length of the first text string with no delimiters from the final string length.

  4. Use a distinct character to replace the delimiter.

  5. Determine the exact position of the delimiter from the text string.

  6. Return the text string to the rightmost side of the delimiter.

Code involved in this process includes:

Using the LEN function:

LEN(A2)

Using the SUBSTITUTE function code:

LEN(SUBSTITUTE(A2,":",""))

Finding the position of the last delimiter:

=SEARCH("#", SUBSTITUTE(A2,":","#",LEN(A2)-LEN(SUBSTITUTE(A2,":",""))))

Returning the text string to the rightmost area of the last delimiter:

=RIGHT(A2,LEN(A2)-SEARCH("$",SUBSTITUTE(A2,":","$",LEN(A2)-LEN(SUBSTITUTE(A2,":","")))))

3. Remove the original N characters from a text string

In addition to pulling a text string from the rightmost side of the string, you can also use the RIGHT function to remove various characters from the start of the string. The following is the code required to perform this function:

RIGHT(string, LEN(string)-number_of_chars_to_remove)

Related: How To Calculate Range in Excel (Plus Real-World Examples)

Examples of the Excel RIGHT function

The following are examples of implementing the RIGHT function in Excel:

Example 1

Here's an example of using the RIGHT function when extracting a substring that follows a specific character:

=RIGHT(B4,LEN(B4)-SEARCH(" ",B4))

Related: 15 Fun Excel Project Ideas To Boost Your Creativity

Example 2

You can use pull a number from a text string with the VALUE and RIGHT functions:

=RIGHT(B4,LEN(B4)-SEARCH(" ",B4))

Example 3

This is an example of using the RIGHT function to pull a domain name from an Excel sheet with emails:

=RIGHT(E4,LEN(E4)-FIND("@",E4))

Example 4

You may also implement the RIGHT function when adjusting a URL:

=LEFT(B4,LEN(B4)-(RIGHT(B4)="/"))

Troubleshooting for the Excel RIGHT function

Some users may come across issues when using the RIGHT function. The following are a few troubleshooting questions with answers to help you best use this function:

Can I use the RIGHT function to extract a number?

The RIGHT function only returns a text string, even if the character's original status is a numeral. There's a way to get around this, though. If you turn the RIGHT function into the VALUE function, it turns a text string into the form of a number or numbers.

Does the RIGHT function allow users to find dates?

In most cases, the RIGHT function won't work with dates. This is because numerals in the program represent dates, and the RIGHT function won't return numbers. If you attempt to extract dates, it only provides you with the last four numbers of the date as represented in the program.

Will the RIGHT function work if the nums_chars is less than zero?

Most users don't use negative numbers when performing the RIGHT function. If you do use a negative number, you'll likely receive a #VALUE! error. When this happens, consider reviewing the nested RIGHT function for issues.

Please note that none of the companies mentioned in this article are affiliated with Indeed.

Explore more articles