The RIGHT function is a built-in function in Excel that is categorized as a String/Text Function. It can be used as a worksheet function (WS) and a VBA function (VBA) in Excel. As a worksheet function, the RIGHT function can be entered as part of a formula in a cell of a worksheet. As a VBA function, you can use this function in macro code that is entered through the Microsoft Visual Basic Editor.
Syntax: =RIGHT(text, num_chars)
The RIGHT function syntax has the following arguments:
text | – | The original text string. |
[num_chars] | – |
An optional argument that specifies the number of characters to be returned from the end of the supplied text. If omitted, the [num_chars] argument takes on the default value of 1. |
Example: Let’s look at some Excel RIGHT function examples and explore how to use the RIGHT function as a worksheet function in Microsoft Excel:
Syntax: =RIGHT(A2,B2)
Result:
Based on the Excel spreadsheet above, the following RIGHT examples would return:
Syntax: =RIGHT(A3,B3)
Result:c com
Syntax: =RIGHT(A4,B4)
Result: RIGHT function
Syntax: =RIGHT(A5,B5)
Result: earn
Syntax: =RIGHT(A6,B6)
Result: 125418745 6/14/1991
Syntax: =RIGHT(A7,B7)
Result: in excel
Note:
- Use the RIGHT function when you want to extract characters starting at the right side of text.
- num_chars is optional and defaults to 1.
- RIGHT will extract digits from numbers as well.
- Number formatting is not part of a and will not be extracted or counted.