RIGHT

Returns the last characters based on the specified length.  If the number of characters are not passed then only returns the right most character.

Syntax

= RIGHT(str)

= RIGHT(str, num_chars)

Parameters

str

A string which contains the characters to be extracted.  The value can be specified as an integer (e.g., 37), a decimal value (e.g., 37.48), as a string (“word”), or as the value of a variable (e.g, UnitPrice).

num_chars (optional)

A positive integer which specifies the number of characters to be extracted.

Return Type

String.

In the case of an error, the function displays an error message: “RIGHT(str): Error message” or “RIGHT(str, num_chars): Error message”.

The function can be used in combination with other functions.

Examples

Example

Returns

= RIGHT(“test”)

“t”

= RIGHT(“Iron Speed Designer”, 8)

“Designer”

= RIGHT(OrderID, 4)

The last four digits of the OrderID.

= RIGHT(“27%”)

“%” sign

= UPPER(RIGHT(“Iron Speed Designer”, 8))

The upper case version of the extracted string.

= TRIM(RIGHT(“Iron Speed Designer”, 9))

A trimmed version of the extracted string.