Excel RIGHT Function

The Excel RIGHT function returns the specified number of characters from a specified string, starting from the right side

Example: Excel RIGHT Function

Excel RIGHT Function

METHOD 1. Excel RIGHT Function using hardcoded values

EXCEL

=RIGHT(B5)
Result in cell D5 (4) - returns the last character from the right side of the specified string as no num_chars is specified.

=RIGHT(B6,3)
Result in cell D6 (234) - return the last three characters from the right side of the string.

=RIGHT(B7,3)
Result in cell D7 (34) - return the last three characters from the right side of the string, including the space between characters.

=RIGHT(B8,4)
Result in cell D8 (2809) - return the last four characters from the right side of the string, which are the numeric date values.

METHOD 2. Excel RIGHT Function using links

EXCEL

=RIGHT(B5)
Result in cell D5 (4) - returns the last character from the right side of the specified string as no num_chars is specified.

=RIGHT(B6,C6)
Result in cell D6 (234) - returns the last three characters from the right side of the string.

=RIGHT(B7,C7)
Result in cell D7 (34) - returns the last three characters from the right side of the string, including the space between characters.

=RIGHT(B8,C8)
Result in cell D8 (2809) - returns the last four characters from the right side of the string, which are the numeric date values.

METHOD 3. Excel RIGHT function using the Excel built-in function library with hardcoded values

EXCEL

Formulas tab > Function Library group > Text > RIGHT > populate the input boxes

=RIGHT(B6,3)
Note: in this example we are populating all the input boxes associated with the RIGHT function.
Built-in Excel RIGHT Function using hardcoded values

METHOD 4. Excel RIGHT function using the Excel built-in function library with links

EXCEL

Formulas tab > Function Library group > Text > RIGHT > populate the input boxes

=RIGHT(B6,C6)
Note: in this example we are populating all the input boxes associated with the RIGHT function.
Built-in Excel RIGHT Function using links

METHOD 1. Excel RIGHT function using VBA with hardcoded values

VBA

Sub Excel_RIGHT_Function_Using_Hardcoded_Values()
'declare a variable
Dim ws As Worksheet
Set ws = Worksheets("RIGHT")
'apply the Excel RIGHT function
ws.Range("D5") = Right(ws.Range("B5"), 1) 'can't have a blank num_chars argument in the VBA code
ws.Range("D6") = Right(ws.Range("B6"), 3)
ws.Range("D7") = Right(ws.Range("B7"), 3)
ws.Range("D8") = Right(ws.Range("B8"), 4)'Note: this will return 15/0 given that the VBA code recognises cell B8 as a text string, not date. The VBA code only recognises a date in United States format and this is written in English style

End Sub

OBJECTS
Worksheets: The Worksheets object represents all of the worksheets in a workbook, excluding chart sheets.
Range: The Range object is a representation of a single cell or a range of cells in a worksheet.
PREREQUISITES
Worksheet Name: Have a worksheet named RIGHT.
ADJUSTABLE PARAMETERS
Output Range: Select the output range by changing the cell references ("D5"), ("D6"), ("D7") and ("D8") in the VBA code to any cell in the worksheet, that doesn't conflict with the formula.

ADDITIONAL NOTES
Note 1: You can't have a blank num_chars argument field in the VBA code and therefore needs to be populated with a value. In this example we populated the num_chars argument with a value of 1 which will return the same value (a) as shown in the Excel RIGHT Function Example above.
Note 2: The output in cell D8 will be 15/0 given that the VBA code recognises cell B8 as a text string, not date. The VBA code only recognises a date in United States format and this is written in English style.

METHOD 2. Excel RIGHT function using VBA with links

VBA

Sub Excel_RIGHT_Function_Using_Links()
'declare a variable
Dim ws As Worksheet
Set ws = Worksheets("RIGHT")
'apply the Excel RIGHT function
ws.Range("D5") = Right(ws.Range("B5"), ws.Range("C5"))'Note: this will return a blank result as the VBA code does not default the empty cell ("C5") to 1
ws.Range("D6") = Right(ws.Range("B6"), ws.Range("C6"))
ws.Range("D7") = Right(ws.Range("B7"), ws.Range("C7"))
ws.Range("D8") = Right(ws.Range("B8"), ws.Range("C8"))'Note: this will return 15/0 given that the VBA code recognises cell B8 as a text string, not date. The VBA code only recognises a date in United States format and this is written in English style

End Sub

OBJECTS
Worksheets: The Worksheets object represents all of the worksheets in a workbook, excluding chart sheets.
Range: The Range object is a representation of a single cell or a range of cells in a worksheet.
PREREQUISITES
Worksheet Name: Have a worksheet named RIGHT.
ADJUSTABLE PARAMETERS
Output Range: Select the output range by changing the cell references ("D5"), ("D6"), ("D7") and ("D8") in the VBA code to any cell in the worksheet, that doesn't conflict with the formula.

ADDITIONAL NOTES
Note 1: The output in cell D5 will be an empty cell given that the VBA code does not default the empty cell ("C5") to 1.
Note 2: The output in cell D8 will be 15/0 given that the VBA code recognises cell B8 as a text string, not date. The VBA code only recognises a date in United States format and this is written in English style.

Usage of the Excel RIGHT function and formula syntax

EXPLANATION

DESCRIPTION
The Excel RIGHT function returns the specified number of characters from a specified string, starting from the right side.
SYNTAX
=RIGHT(text, [num_chars])
ARGUMENTS
text: (Required) The string from which to extract the characters.
num_chars: (Optional) The number of characters to extract from the specified string, starting from the right side.

ADDITIONAL NOTES
Note 1: The default num_chars argument is 1. Therefore, if the argument is empty the Excel RIGHT function will default to value 1.
Note 2: The RIGHT function ignores the number formatting.
Note 3: In reference to date format the RIGHT function recognises its numeric value, only if the date is written in United States format.
Note 4: The RIGHT function ignores decimal places.