LEFT

Description

The LEFT function extracts a specified number of characters from the start of a text value.

Usage

RIGHT(text, number_characters)
Argument Type Required Description
text Text Yes The input text
number_of_characters Numeric Yes The number of characters to include

Remarks

If the text argument is blank, or number_of_characters is zero, then the result is will be a blank text value.

Right-to-left languages

Note that while the name of the function, "LEFT", is inherited from Excel, it always refers to the beginning of the text, regardless of the writing direction. For Right-to-left languages, the LEFT function extracts the given number of characters from the start of the text, which would actually be the right-most characters visually speaking.

For example, if you had a field TEXT containing the text سلام الکس and the formula LEFT(TEXT, 4) is equal to "سلام".

Example

In some cases, you might have a registration number, phone number, or other text that contains information embedded in the code. For example, in Holland, the first two digits of fixed-line phone numbers indicate the city. Numbers starting with "070" like 070 353 3000 belong to the City of the Hague, while those starting with "020" such as 020 334 4522 are in Amsterdam.

You can find the first three digits of a PHONE_NUBMER text field using the formula:

LEFT(PHONE_NUMBER, 3)

You can then use the IF function to compute the city based on these first three digits:

IF(LEFT(PHONE_NUMBER, 3) == "070", "The Hague", 
  IF(LEFT(PHONE_NUMBER, 3) == "020", "Amsterdam", "Other"))
Next item
POWER