Returns the specified number of characters at the end of a textual value. If the number of characters to be returned is greater than the length of the text value or less than 0
, returns the text value in its entirety.
Sample usage
RIGHT("123 Maple Dr", 5)
returns le Dr
RIGHT("123 Maple Dr", 0)
returns blank
Fractional component of Decimal value
The fractional component of a Decimal
value in the Result
column:
NUMBER(
RIGHT(
TEXT([Result]),
(LEN(TEXT([Result]))
- FIND(".", TEXT([Result])))
)
)
TEXT([Result])
converts theDecimal
value to aText
value. The textual functions used in this example interpret non-textual values differently. UsingTEXT()
ensures theResult
column value is interpreted the same by each function.FIND(".", ...)
locates the decimal point in the value.(LEN(...) - FIND(...))
calculates the length of the fractional component by subtracting the length of the non-fraction part from the entire length.RIGHT(..., ...)
extracts the fractional part.NUMBER(...)
converts the extracted text to aNumber
.
See also: FIND()
, LEN()
, NUMBER()
, TEXT()
Street name from street address
Everything after the first word of a street address, which is typically the street name:
RIGHT([Address], (LEN([Address]) - FIND(" ", [Address])))
-
FIND(" ", [Address])
locates the first/leftmost space in theAddress
column value. -
LEN([Address]) - FIND(...)
calculates the length of theAddress
column value beyond the first space by subtracting the length of the text preceding the first space from the total length. -
RIGHT([Address], ...)
returns the rightmost text following the first space.
Syntax
RIGHT(text, how-many)
text
- Any textual type.how-many
- Number of characters (Number
) fromtext
to return. Non-Number
values may be accepted but may produce unexpected results.