LEFT

Returns string of specified length from the left of the string passed to the function. If the number of characters are not passed then only returns the left most character.

Syntax

= LEFT(str)

= LEFT(str, num_chars)

Parameters

Str

A string which contains the characters to be extracted.  The value can be specified as an integer (e.g., 37), as a decimal value (e.g., 37.48), as a string (“word”), or as the value of a variable (e.g, UnitPrice).

num_chars (optional)

A positive integer which specifies the number of characters to be extracted.

Return Type

String.

In the case of an error, the function displays an error message: “LEFT(str): Error message” or “LEFT(str, num_chars): Error message”.

The function can be used in combination with other functions.

Examples

Example

Returns

= LEFT(“test”)

“t”

= LEFT(“Iron Speed Designer”, 10)

“Iron Speed”

= LEFT(OrderID, 4)

The first four digits of the OrderID.

= LEFT(“$1234”)

“$” sign

= UPPER(LEFT(“Iron Speed”, 4))

The upper case version of the extracted string.

= CONCATENATE(LEFT(“Iron Speed Designer”, 10), “,a .NET code generator”)

A concatenated version of the extracted string and the passed string.