Function · Text

Excel LEN function

The Excel LEN function counts characters, including spaces. A five-digit ZIP code is 5. A ZIP+4 with a hyphen is 10.

All current Excel versions. Also in Excel for the web and Google Sheets.

Syntax =LEN(text)

LEN
=LEN("78701")

Arguments

NameRequiredWhat to pass
textRequiredThe text to measure. Numbers are converted to their plain text form first.

Examples

A five-digit Austin ZIP code

=LEN(B1)

Result 5

=LEN(B1)B2
ZIP
AB
1ZIP78701
2Length5
A picture of the sheet, not a live calculator. Store ZIP codes as text so a leading zero in other states survives.

LEN counts characters. 78701 is five characters, which is the check for a basic US ZIP code. 78701-1234 is ten characters, hyphen included. Spaces count. A trailing space makes a five-digit ZIP look six characters long and fail the check.

LEN of a number uses the number’s plain digits, not what a format displays. A Boston ZIP typed into a numeric cell becomes 2101, and LEN returns 4. Keep postal codes as text. After TRIM, recheck the length. TRIM will not remove a non-breaking space, and that leftover character still counts. Counting words after TRIM is xl.count.words.