RIGHT Function in Excel
For example, “=RIGHT(“APPLES”,2)” gives “ES” as the result.
Similar to the RIGHT function, the LEFT function in excelLEFT Function In ExcelThe left function returns the number of characters from the start of the string. For example, if we use this function as =LEFT ( “ANAND”,2), the result will be AN.read more returns the characters from the left side of the string.
Syntax
The syntax of the RIGHT function is stated as follows:
You are free to use this image on you website, templates, etc., Please provide us with an attribution linkHow to Provide Attribution?Article Link to be HyperlinkedFor eg:Source: RIGHT Function in Excel (wallstreetmojo.com)
The RIGHT function accepts the following two arguments:
- 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#VALUE! Error#VALUE! Error in Excel represents that the reference cell the user has either entered an incorrect formula or used a wrong data type (mostly numerical data). Sometimes, it is difficult to identify the kind of mistake behind this error.read more.”
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 FINDFINDFind function in excel finds the location of a character or a substring in a text string. In other words it finds the occurrence of a text in another text, as it gives us the position, the output returned by this function is an integer.read more, SEARCHSEARCHSearch function gives the position of a substring in a given string when we give a parameter of the position to search from. As a result, this formula requires three arguments. The first is the substring, the second is the string itself, and the last is the position to start the search.read more, LENLENThe Len function returns the length of a given string. It calculates the number of characters in a given string as input. It is a text function in Excel as well as an inbuilt function that can be accessed by typing =LEN( and entering a string as input.read more, 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 textFormat TextText formatting in Excel include changing the colour, font name, font size, alignment, font appearance in bold, underlining, italic, background colour of the font cell, and so on.read more.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.
Let us apply the RIGHT formula to extract “string” in A3.
We use “=RIGHT(A3,6).”
The RIGHT formula returns “string.”
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.
We apply the formula “=RIGHT(A3,4).”
The RIGHT function returns 2101 in cell B3. In the same way, we extract the last four digits of all the IDs.
Example #3
We have a 6-digit number (140111) and want to extract the last 3 digits from this number.
We apply the formula “=RIGHT(A4,3)” to extract the last three digits.
The RIGHT function returns 111.
Example #4
We have the date “12/07/2018” in cell A5. We want to extract the last few digits.
To extract the last three digits, we apply the formula “=RIGHT(A5, 3).”
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.
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.
The output of the RIGHT formula is “Wolf.” Similarly, we find the output for the remaining cells as well.
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.
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.”
The RIGHT formula returns “150 ft” for the first dimension. Drag the fill handle to get the results for the remaining cells.
Example #7
We have a list of email addresses. We want to extract the domain name from these email IDs.
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.
The RIGHT formula returns “amazon.com” in cell D3.
Similarly, we apply formulas to the remaining cells as well.
Example #8
We have some URLs shown in the following image. We want to remove the last backslash from these URLs.
We apply the following formula.
“=LEFT(C3,LEN(C3)-(RIGHT(C3)=”/”))”
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.
The formula returns the complete string in cell D3.
Frequently Asked Questions
The LEFT and RIGHT functions extract characters or substrings from the left and the right side of the source string, respectively. The MID functionMID FunctionThe mid function in Excel is a text function that finds strings and returns them from any mid-part of the spreadsheet. read more extracts characters from the middle of the string.The syntax of the three functions is stated as follows:“=LEFT(text, [num_chars])”“=RIGHT(text, [num_chars])”“=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 shouldbegin.
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.
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 functionVALUE FunctionIn Excel, the value function returns the value of a text representing a number. So, if we have a text with the value $5, we can use the value formula to get 5 as a result, so this function gives us the numerical value represented by a text.read more.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.
Key Takeaways
- The RIGHT function gives a specified number of characters from the right side of a textstring.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 valueswith 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 –
- VBA Left FunctionVBA Left FunctionExcel VBA Left is an inbuilt worksheet text function that facilitates the user to extract a certain number of characters (denoted as N) from the left side of a string. It helps in pulling the leftmost substring from a particular string in the data set.read moreRIGHT Function in Excel VBARIGHT Function In Excel VBAThe Right Function returns the substring from a given string, but the search is done from right to left. This is a type of string function in VBA used with application. worksheet function method.read moreAccess vs ExcelAccess Vs ExcelExcel and Access are two of Microsoft’s most powerful tools for data analysis and report generation, but there are some significant differences between them. Excel is an older product of Microsoft, whereas Access is the most advanced and complex product of Microsoft. Excel is very easy to create dashboards and formulas, whereas Access is very easy for databases and connections.read moreNull in ExcelNull In ExcelNull is a type of error in Excel that occurs when two or more cell references provided in formulas are wrong, or when their position is incorrect. Using space in formulas between two cell references, for example, will result in a null error.read more