1. Calculation functions
2. All Functions
3. Miscellaneous Functions
4. LEFT

Extracts a number of characters from a string, starting from the leftmost character.

Syntax

`LEFT(Text [, Number of characters]) `
 Argument Data type Description Text (required) Text The text to extract characters from. Number of characters (optional) Number The number of characters to extract from the text string.

Returns

The LEFT function returns a text-formatted result.

Arguments

The Text argument can refer to a text-formatted line item, text constant, or general expression.

The optional Number of characters argument can refer to a numeric line item, property, or expression. If you omit this argument, the default behavior returns only the leftmost character from the text string. If you use a negative number or zero for the Number of characters argument, the function returns a blank result. If the Number of characters argument is greater than the number of characters in the Text argument, the function returns only the characters in the string.

Constraints

The LEFT function has this constraint:

Examples

In this example, a Clothing list displays on columns, with four items, Hats, Shirts, Shorts, and Trousers.

Line items display on rows and are text-formatted. The exception to this is the Clothing List line item, which is list-formatted. The first three line items Red Product, Blue Product, and Yellow Product contain product names. These product line items are used for the Text arguments in the formulas in the module.

This table shows the formulas and their results for each of the list items Hats, Shirts, Shorts, and Trousers:

 Formula Result Description `LEFT(Red Product, 3)` Red, Red, Red, Red Returns the leftmost three characters of the text strings in the Red Product line item. `LEFT(Blue Product, 4)` Blue, Blue, Blue, Blue Returns the leftmost four characters of the text strings in the Blue Product line item. `LEFT(Yellow Product, 6)` Yellow, Yellow, Yellow, Yellow Returns the leftmost six characters of the text strings in the Yellow Product line item. `LEFT(NAME(Clothing List), 3)` Hat, Shi, Sho, Tro This formula extracts text from a list-formatted line item. The LEFT function can only be used with text-formatted line items. This formula uses the NAME function to convert the list-formatted Clothing List line item to text-formatted.

This formula uses the ITEM function to return the list-formatted column names. It then uses the NAME function to convert them to text, and returns the first five letters of the strings with the LEFT function.

`LEFT(NAME(ITEM(Products)), 5)`