Elite Membership

RIGHT Function in Excel

Written by Vidya Subbu Vidya Subbu Excel Content Writer & Editor Vidya, a former software engineer turned seasoned content writer with 7+ years of experience, excels in creating engaging content. As an editor at WallStreetMojo, she dreams of publishing her own book. 7+ years of experience B.E. (Electronics and Instrumentation) MS Excel - Basic and Advanced View Full Profile
Reviewed by Dheeraj Vaidya, CFA, FRM Dheeraj Vaidya, CFA, FRM Content Reviewer & Course Director Dheeraj is a former J.P. Morgan and CLSA Equity Analyst with nearly two decades of experience in financial modeling, valuation, equity research, and corporate finance. He specializes in helping students and professionals develop practical and in-demand finance skills through structured and AI-powered, 20+ Years of experience CFA, FRM, IIT Delhi, IIM Lucknow Financial Modeling View Full Profile
Updated Dec 20, 2024
Read Time 7 min

RIGHT Function in Excel

The RIGHT function is a text string function that gives the number of characters from the right side of the string. It helps extract characters beginning from the rightmost side to the left. The result depends on the number of characters specified in the formula.

Download FREE RIGHT Function Excel Template and Follow Along!
Download Excel Template

For example, โ€œ=RIGHT(โ€œAPPLESโ€,2)โ€ gives โ€œESโ€ as the result.

Similar to the RIGHT function, the LEFT function in excel returns the characters from the left side of the string.

Syntax

The syntax of the RIGHT function is stated as follows:

Right Function Formula

The RIGHT function accepts the following two arguments:

Key Takeaways

  • Text: The text string that contains the characters to be extracted.
  • Num_chars: The number of characters to be extracted from the string starting from the rightmost side.

The โ€œtextโ€ is a mandatory argument and โ€œnum_charsโ€ is an optional argument.

The Characteristics of โ€œNum_Charsโ€

The features of โ€œnum_charsโ€ are listed as follows:

  • The default value of โ€œnum_charsโ€ is set at 1. This means that if the value of โ€œnum_charsโ€ is omitted, the RIGHT function returns the last letter of the string.
  • If โ€œnum_charsโ€ is greater than the length of the text, the RIGHT function returns the complete text.
  • If โ€œnum_charsโ€ is less than zero, the RIGHT function returns the โ€œ#VALUE! error.โ€

Note: The RIGHT function should not be used with numbers. Though it performs the same operation on digits as it does with text, it returns wrong values with numbers formatted as text.

How To Use RIGHT Function in Excel?

The RIGHT function is mostly used in combination with other Excel functions like FIND, SEARCH, LEN, LEFT, etc.

The uses of the RIGHT function are listed as follows:

  • It removes the trailing slash in URLs.
  • It extracts the domain name from the email address.
  • It helps format text.
  • It extracts text occurring after a specific character.

Example #1

A text string is given in cell A3, as shown in the succeeding image. We want to extract the last word having six letters.

RIGHT Function Example 1

Let us apply the RIGHT formula to extract โ€œstringโ€ in A3.

We use โ€œ=RIGHT(A3,6).โ€

RIGHT Function Example 1-1

The RIGHT formula returns โ€œstring.โ€

RIGHT Function Example 1-2

Example #2

The following image shows a list of IDs like โ€œID2101,โ€ โ€œID2102,โ€ โ€œID2103,โ€ etc., in column A.

Here, the last four digits of the ID are unique and the text โ€œIDโ€ is redundant. So, we want to remove โ€œIDโ€ from the list of identifiers.

RIGHT Function Example 2

We apply the formula โ€œ=RIGHT(A3,4).โ€

RIGHT Function Example 2-1

The RIGHT function returns 2101 in cell B3. In the same way, we extract the last four digits of all the IDs.

RIGHT Function Example 2-2

Example #3

We have a 6-digit number (140111) and want to extract the last 3 digits from this number.

RIGHT Function Example 3

We apply the formula โ€œ=RIGHT(A4,3)โ€ to extract the last three digits.

RIGHT Function Example 3-1

The RIGHT function returns 111.

RIGHT Function Example 3-2

Example #4

We have the date โ€œ12/07/2018โ€ in cell A5. We want to extract the last few digits.

RIGHT Function Example 3-3

To extract the last three digits, we apply the formula โ€œ=RIGHT(A5, 3).โ€

RIGHT Function Example 3-4

The function returns 293 instead of 018. This is because it considers the original value of the date before returning the output. So, the RIGHT function does not give the correct answer in this case.

Example #5

We have the names of two animals in column A. The names are separated by a comma and space, as shown in the following image. We want to extract the last name.

RIGHT Function Example 4

We apply the following RIGHT formula.

โ€œ=RIGHT(A4,LEN(A4)-FIND(โ€œ โ€,A4))โ€

The โ€œFIND(โ€œ โ€,A4)โ€ finds the location of the space. It returns 5. Alternatively, we can use โ€œ,โ€ for a stricter search.

The โ€œLEN(A4)โ€ calculates the length of the string โ€œDog, Wolf.โ€ It returns 9.

The โ€œLEN(A4)-FIND(โ€œ โ€,A4)โ€ returns the position of the space from the right. It returns 4.

The formula โ€œRIGHT(A4,LEN(A4)-FIND(โ€œ โ€,A4))โ€ returns four letters from the right of the text string in A4.

RIGHT Function Example 4-1

The output of the RIGHT formula is โ€œWolf.โ€ Similarly, we find the output for the remaining cells as well.

RIGHT Function Example 4-2

Example #6

We have two-dimensional data, the length multiplied by the width, as shown in the following image. We want to extract the width from the given dimensions.

RIGHT Function Example 5

For the first dimension, we apply the following RIGHT formula.

โ€œ=RIGHT(B4,LEN(B4)-(FIND(โ€œxโ€,B4)+1))โ€

The โ€œFIND(โ€œxโ€,B4)โ€ gives the position of โ€œxโ€ in the cell. It returns 8.

The formula โ€œFIND(โ€œxโ€,B4)+1โ€ returns 9. Since โ€œxโ€ is followed by a space, we add one to omit the space.

The โ€œLEN(B4)โ€ returns the length of the string.

The โ€œLEN(B4)-(FIND(โ€œxโ€,B4)+1)โ€ returns the number of characters occurring after โ€œxโ€+1.

The formula โ€œRIGHT(B4,LEN(B4)-(FIND(โ€œxโ€,B4)+1))โ€ returns all the characters occurring in one place after โ€œx.โ€

RIGHT Function Example 5-1

The RIGHT formula returns โ€œ150 ftโ€ for the first dimension. Drag the fill handle to get the results for the remaining cells.

RIGHT Function Example 5-2

Example #7

We have a list of email addresses. We want to extract the domain name from these email IDs.

RIGHT Function Example 6

We apply the following RIGHT formula to extract the domain name from the first email address.

โ€œ=RIGHT(C3,LEN(C3)-FIND(โ€œ@โ€,C3))โ€

The โ€œFIND(โ€œ@โ€,C3)โ€ finds the location of โ€œ@โ€ in the string. For cell C3, it returns 7.

The โ€œLEN(C3)โ€ gives the length of the string C3. It returns 17.

The โ€œLEN(C3)-FIND(โ€œ@โ€,C3)โ€ gives the number of characters occurring to the right of โ€œ@.โ€ It returns 10.

The โ€œRIGHT(C3,LEN(C3)-FIND(โ€œ@โ€,C3))โ€ gives the last 10 characters of cell C3.

RIGHT Function Example 6-1

The RIGHT formula returns โ€œamazon.comโ€ in cell D3.

RIGHT Function Example 6-2

Similarly, we apply formulas to the remaining cells as well.

RIGHT Function Example 6-3

Example #8

We have some URLs shown in the following image. We want to remove the last backslash from these URLs.

RIGHT Function Example 7

We apply the following formula.

โ€œ=LEFT(C3,LEN(C3)-(RIGHT(C3)=โ€/โ€))โ€

By default, the RIGHT function returns one value on the rightmost side, i.e., the last value.

If the last character is a forward slash (/), โ€œ(RIGHT(C3)=โ€/โ€)โ€ returns โ€œtrue,โ€ else it returns โ€œfalse.โ€ These โ€œtrueโ€ and โ€œfalseโ€ change to one and zero, respectively.

If the last character is a forward slash (/), one is subtracted from the length of the string. This means that if the last character is โ€œ/โ€, the โ€œLEN(C3)-(RIGHT(C3)=โ€/โ€))โ€ omits it.

The โ€œ=LEFT(C3,LEN(C3)-(RIGHT(C3)=โ€/โ€))โ€ returns the first โ€œnโ€ number of characters. If the last character is a forward slash (/), it is omitted; else, the complete string is returned.

RIGHT Function Example 7-1

The formula returns the complete string in cell D3.

RIGHT Function Example 7-2

Similarly, we apply formulas to the remaining cells as well.

RIGHT Function Example 7-3

Frequently Asked Questions (FAQs)

#1 – What are the LEFT, RIGHT, and MID functions in Excel?

The LEFT and RIGHT functions extract characters or substrings from the left and the right side of the source string, respectively. The MID function extracts characters from the middle of the string.

The syntax of the three functions is stated as follows:

โ€œ=LEFT(text, )โ€
โ€œ=RIGHT(text, )โ€
โ€œ=MID(text, start_num, num_chars)โ€

The arguments are explained as follows:

– Text:ย The actual text string that contains the characters to be extracted. This is usually in the form of a cell reference.
– Num_chars: The number of characters to be extracted from the string.
– Start_num: The position within the source data string from where the extraction should
begin.

#2 – How to remove characters by using the RIGHT function in Excel?

The number of characters to be removed is subtracted from the total length of the string. For this, the following formula is used:

โ€œ=RIGHT(string,LEN(string)-number_of_chars_to_remove)โ€

The โ€œstringโ€ is the entire source string. The โ€œnumber_of_chars_to_removeโ€ contains the number of characters to be removed from the source string.

#3 – How to use the RIGHT function for numbers in Excel?

The RIGHT function always returns a text string even if the source string is in the form of numbers. To get the output as a number from a string of numbers, the RIGHT function is nested in the VALUE function.

The formula is stated as follows:

โ€œ=VALUE(RIGHT(string, num_chars))โ€

The โ€œstringโ€ is the source string containing numbers. The โ€œnum_charsโ€ is the number of digits to be extracted from the string.

Note: In Excel, the numbers string is right-aligned while the text string is left-aligned.

  • The RIGHT function gives a specified number of characters from the right side of a text
    string.
  • The RIGHT function extracts characters beginning from the rightmost side to the left.
  • The RIGHT function accepts two argumentsโ€“โ€œtextโ€ and โ€œnum_chars.โ€
  • The default value of โ€œnum_charsโ€ is set at 1.
  • If โ€œnum_charsโ€ is greater than the length of the text, the RIGHT function returns the complete text.
  • If โ€œnum_charsโ€ is less than zero, the RIGHT function returns the โ€œ#VALUE! error.โ€
  • The RIGHT function should not be used with numbers because it returns wrong values
    with numbers formatted as text.

Recommended Articles

This has been a guide to RIGHT Function in Excel. Here we discuss the RIGHT Formula in Excel and how to use the RIGHT Excel function along with Excel examples and downloadable Excel templates. You may also look at these useful functions in Excel –