Description:
This function RIGHT returns the last character or characters in a text string, based on the number of characters you specify.
Syntax: RIGHT (text, num_chars)
Num_chars
- specifies the number of characters you want RIGHT
to extract.
Remarks
Example
The RIGHT function can be used in any database where you have stored any text values and you want to extract some part from the RIGHT of that text value. The function extracts the value from the right of the text specified up to the number of characters specified and it returns the extracted text as the result of the function. This function returns this text value as its result after the function computes the two parameters supplied to this function and after the function determines the characters as per the number specified, which are from the RIGHT of the text value that is given as an input to the function.
=RIGHT ("Sale Price", 4) |
-Four characters from the right in the string (rice) |
=RIGHT ("Switzerland") |
-Last character in the string (D) |
Note: A number supplied within double quotes is taken as a string parameter.
Let us take the example of a database in PowerOLAP where we have certain text values for name, last name, city, country etc., and we need to manipulate these text values and arrive at results with different permutations and combinations. We shall use this example in this case to find the characters to the RIGHT of the text which is "Input" to this cube, in this instance it is "City" member. Here we have written a formula in the appropriate cube in PowerOLAP, pulling in the value from the above mentioned parameters and then calculating the values to the right of the parameter supplied. A text value is returned as the result for the RIGHT function.
The formula above writes values into the "StringDataFunctions" cube to the "String Data Manipulations" dimension into the member named "RIGHT" by calculating the appropriate value for this member, based upon the parameters that are given as input to this function, namely the reference for the "City" and the number parameter "6". The result is returned calculating the RIGHT values in the text specified counting from the number parameter. The extracted text value is the text returned by the function.