Description
The RIGHT
function extracts a specified number of characters from the end of a text value.
Usage
RIGHT(text, number_characters)
Argument | Type | Required | Description |
---|---|---|---|
text | Text | Yes | The input text |
number_of_characters | Numeric | Yes | The number of characters to include |
Remarks
If the text
argument is blank, or number_of_characters
is zero, then the result is will be a blank text value.
Right-to-left languages
Note that while the name of the function, "RIGHT", is inherited from Excel, it always refers to the end of the text, regardless of the writing direction. For Right-to-left languages, the RIGHT function extracts the given number of characters from the end of the string, which would actually be the left-most characters visually speaking.
For example, the formula RIGHT("سلام الکس", 4)
is equal to "الکس"
.
Example
Sometimes registration or national ID numbers encode information about their holders. For example, in Switzerland residents used to be issued an eleven-digit format in the form AAA.BB.CCC.DDD where the "DDD" digits are an origin code
You could extract these last four digits using the formula:
RIGHT(NATIONAL_ID, 4)