
The Excel RIGHT function extracts a given number of characters from the right side of a supplied text string. For example, RIGHT(“apple”,3) returns “ple”.
Purpose
Extract text from the right of a string
Return value
One or more characters.
Syntax
=RIGHT (text, [num_chars])
Arguments
- text – The text from which to extract characters on the right.
- num_chars – [optional] The number of characters to extract, starting on the right. Optional, default = 1.
USES
The RIGHT function extracts a given number of characters from the right side of a supplied text string. The second argument, called num_chars, specifies the number of characters to extract. If num_chars is not provided, it defaults to 1. If num_chars is greater than the number of characters available, RIGHT returns the entire text string.
Examples
In the example below, we extract the state code “OR” (Oregon) from the string “Portland, OR”
=RIGHT ("Portland, OR",2) // returns "OR"
If the optional argument num_chars is not provided, it defaults to 1:
=RIGHT("ABC") // returns "C"
If num_chars exceeds the string length, LEFT returns the entire string:
=RIGHT("apple",100) // returns "apple"
When LEFT is used on a numeric value, the result is the text:
=RIGHT (1200,3) // returns "200" as text
The RIGHT function is often combined with other functions like LEN and FIND to extract text in more complex formulas. For example, to extract text in cell A1 to the right of a specific character (char), use RIGHT with the FIND and LEN functions like this:
=RIGHT (A1, LEN (A1)-FIND (char, A1)) // text to right char