How to use the RIGHT Function in Excel
Description
The RIGHT Function is categorized as Text Function in Excel. This function extract the last character of a text string or number of characters from right most end of the text string based on the number of character specified.
The RIGHT function takes one argument which can be a text string or any cell reference or a number. It can also be used as a part of a formula.
Syntax
The syntax of RIGHT function is =RIGHT(text,[num_chars])
Argument or Parameter
text (Required)- can be a text string or cell reference or a number from which we want extract the text string.
num_chars (Optional) - is the number of character you want to extract from the given text string.
- If the num_chars is omitted, it will assume it as 1.
- If the num_chars is 0, then it will return blank.
- If the num_chars must be greater than 0 to return any text.
Returns
The RIGHT function returns specified number of character from the right most end of the given text string.
Example
Example-1
In the example given below, we can see output returned from the given text value.
In the first two case we did not specify any num_chars so it returned single character from the end of the text string. This because if num_chars is omitted, it is assumed as 1.
In the 3rd case, we specify num_chars as 2. So we get the two characters from the end of the given text string.
In the 4th case, we specify num_chars as 8 and we got the last 8 character from the end of the given text string.
All the formulas of the column B is displayed in column C.
Example-2
In this example, we have some email addresses in column and we need to extract the domain name from it. We can see that every domain name have different number of character count so we cannot use a fixed value as num_chars. So we need to find a common between all the text string, and the common thing is we need the text strings after @. Now need to find out the position of the @ in the text string because total length of the text string subtracted by position of @ , we will get the number of text string after @ . You can see the formula in image below in place of num_chars we used LEN(A3)-SEARCH("@",A3). LEN function returns the total length of the text and SEARCH functions returns the position of @ in the text string. In output we got the domain name.
To better understand SEARCH function click HERE.
Example-3
In this example, we have some names and we want to extract the last name of the each full name. So here again we will use SEARCH function to know the position of space after the first name. If the first example the text is Manoj Saha, it has total 10 characters including space. To determine the position of space use formula =SEARCH(" ",A3), result will be 6. So 10-6=4, we last 4 characters and we can the last name Saha has 4 characters. So in place of num_chars we will use, =SEARCH(" ",A3) and will get Saha as result.
In A6 we have first name first name, middle name and last name, here we need to determine the position 2nd space. SO for that we have to use the formula =SEARCH(" ",A6,SEARCH(" ",A6)+1) and with this formula we will get the position of 2nd space. So we need to use this formula in num_chars and get the result as Singha.
To better understand SEARCH function click HERE.
Example-4
In this example, we have some product keys and each product key have four groups of characters and we need to extract the last group. For this we need to know the position of 3rd dash(-) and that position value will be used in num_chars. Type =SEARCH("-",A3,SEARCH("-",A3,SEARCH("-",A3)+1)+1) and we will get the position of the 3rd dash as 12. So Total length text string - position of 3rd (-) will be 3. In place of num_chars use the formula =SEARCH("-",A3,SEARCH("-",A3,SEARCH("-",A3)+1)+1). See the image below.
To better understand SEARCH function click HERE.
Notes
- RIGHT can extract digits from numbers.
- Number formatting are not extracted.
- If the num_chars is less than 0, then it will return #Value.
********************************* ~:Support Our Work Financially:~ *********************************
Project File Type: Free
If you think this tutorial helps you to solve your problem and add value to your work, Buy me a Coffee..
************************************************************************************************
|
||||
CHAR |
CLEAN |
CONCATENATE |
||
DOLLAR |
EXACT |
FIND |
FIXED |
LEFT |
LEN |
MID |
NUMBERVALUE |
||
REPLACE |
REPT |
RIGHT |
SEARCH |
SUBSTITUTE |
T |
TEXT |
TRIM |
UNICHAR |
UNICODE |
UPPER |
VALUE |
|
|
|
0 Comments