RIGHT

You can use RIGHT when you need a specific part of a text item. For example, a customer number might have several uses and sometimes only the last three characters are needed. RIGHT can be used to return only the rightmost three characters.

The RIGHT function returns a specified number of characters from a text expression beginning with the rightmost byte of a text item.

Syntax:
RIGHT (single-text-expression , single-integer-expression)
Meaning:
RIGHT (text_to_extract_from , number_of_characters_to_extract)
Returns:
A single text item

RIGHT returns the rightmost number_of_characters_to_extract characters from text_to_extract_from starting at the last (the rightmost) character in text_to_extract_from.

If number_of_characters_to_extract evaluates to an integer whose value is less than 1, RIGHT evaluates to "none". If number_of_characters_to_extract evaluates to an integer whose value is greater than the size of text_to_extract_from, RIGHT evaluates to the entire value of text_to_extract_from.

Examples

  • RIGHT ("Abcd" , 2)

    Returns cd

  • RIGHT ("Abcd" , 6)

    Returns Abcd

  • RIGHT ("000000" + NUMBERTOTEXT (TransactionNum), 6)

    If TransactionNum contains 123, this example returns 000123. If TransactionNum contains 123456789, this example returns 456789.

Related functions

  • FIND
  • LEFT
  • MID

Feedback