LEN (length)

<< Click to Display Table of Contents >>

LEN (length)

Syntax:

LEN(Value)

Description:

This returns the number of characters in a text string.

If the specified value is a number, a date or a logical value, it will be converted to a string automatically.

Note: For dates, the serial date number is converted to a string and not the formatted date itself (see last example).

Example:

LEN("Text") returns 4

LEN(42) returns 2

LEN(-42) returns 3

LEN(42.5) returns 4

LEN(42.50) also returns 4 (the superfluous zero is automatically removed!)

LEN(TRUE) returns 4

Please note when specifying dates: If cell A1 contains the date 09/25/2014 in any format, the following applies:

LEN(A1) returns 5

Reason: Date values are always stored as numbers in a spreadsheet – the date 09/25/2014, for example, as 41907. Thus, the result of the calculation is unexpected but completely correct – because:

LEN(41907) also returns 5

See also:

LEFT, RIGHT, MID