Returns the rightmost characters from a text string.
Sample Usage
RIGHT("Hello World", 3)
Syntax
RIGHT(
-
text
-
[
num_chars]
-
text—The text containing the characters to return.
-
num_chars—[optional]Starting from the rightmost character, the number of characters to return. If a number isn’t provided, only the first character from the right will be returned.
Usage Notes
- With right-to-left languages (such as Arabic), RIGHT will return the leftmost characters instead.
Examples
This example references the following sheet information:
Clothing Item | Sold Date | Status | Order Date | |
---|---|---|---|---|
1 | T-Shirt | 02/12/19 1:55 PM | Green | 02/12/19 |
2 | Pants | 02/15/19 10:23 AM | Red | 02/15/19 |
3 | Jacket | 02/20/19 2:45 PM | Yellow | 02/20/19 |
Given the table above, here are some examples of using RIGHT in a sheet:
Formula | Description | Result |
---|---|---|
=RIGHT([Clothing Item]1, 5) | Returns the rightmost 5 characters from the “Clothing Item” column for row 1. | Shirt |
=COUNTIF([Sold Date]:[Sold Date], RIGHT(@cell, 2) = "PM") | Counts the number of values in the “Sold Date” column that return the rightmost 2 characters at the cell level equal to “PM”. Row 1 and 3 apply. | 2 |
=IF(Status2 = "Red", RIGHT([Order Date]2, 8)) | Returns the rightmost 8 characters from a “Order Date” column, row 2, if the “Status” column, row 2, equals “Red”. | 02/15/19 |