RIGHT
- RIGHT(input_string, length)[source]
Returns a substring consisting of the rightmost characters from a string.
This function mimics the behavior of Excel’s RIGHT function. It extracts a substring from the end of input_string, searching backwards up to the number of characters specified by length. Both singular values and arrays are supported. If any argument is blank or in an error state, the formula evaluates to an error.
- Parameters:
input_string (
Operand|str) –The string from which characters will be extracted. Can be a literal string, a field, formula, calculation, or parameter.
Supported types:
STRING
STRING_ARRAY
length (
Operand|int) –The number of characters to extract from the right of input_string. If negative, the formula evaluates to an error.
Supported types:
INTEGER
INTEGER_ARRAY
- Return type:
- Returns:
The substring consisting of the rightmost characters of input_string up to index. If either input is an array, an array of substrings is returned.
Supported types:
STRING
STRING_ARRAY
- Raises:
ValueError – if input_string is not of type STRING or STRING_ARRAY.
ValueError – if index is not of type INTEGER or INTEGER_ARRAY.
Examples
Basic usage:
RIGHT("Hello World", 5) # Returns "World"
Using a Field or Formula:
RIGHT(customer["name"], 3) # Returns last three characters of the customer's name
With array input:
RIGHT(["Apple", "Banana", "Cherry"], 2) # Returns ["ue", "le", "ry"]