Text

LEN Formula

LEN returns the number of characters in a text string, including spaces. It is used for data validation (checking if entries meet length requirements), calculating dynamic extraction positions for MID/LEFT/RIGHT, and identifying unexpectedly long or short entries in a dataset.

Syntax

LEN(text)
ParameterDescription
text Parameter of the LEN function.
Try LEN in Viztab — free, no signup

Examples

Check length of a text entry

Formula
=LEN(A2)
Returns: 10 — the number of characters in "John Smith" (including the space)

Validate phone number length

Formula
=IF(LEN(A2)=10, "Valid", "Invalid")
Returns: "Valid" if the phone number has exactly 10 digits, "Invalid" otherwise

Count extra spaces

Formula
=LEN(A2)-LEN(TRIM(A2))
Returns: 3 — the number of extra spaces in the text (leading, trailing, or double spaces)

Common Errors

#VALUE!

The argument is an error value, not a text string. Wrap with IFERROR if the source cell might contain errors.

Tips

Numbers have length too

LEN(12345) returns 5. Dates return the length of their underlying number, not the displayed format.

Find trailing spaces

If LEN(A1) is longer than expected, there may be invisible trailing spaces. Use TRIM to clean them.

Use with RIGHT

=RIGHT(A1, LEN(A1)-FIND(" ",A1)) is a common pattern to extract everything after a space.

Try LEN in Viztab

Import your data and use LEN with 370+ other formulas. No signup required.

Open Viztab

Related Formulas