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.
Syntax =LEN(text)
=LEN("78701")Arguments
| Name | Required | What to pass |
|---|---|---|
| text | Required | The text to measure. Numbers are converted to their plain text form first. |
Examples
A five-digit Austin ZIP code
=LEN(B1)Result 5
| A | B | |
|---|---|---|
| 1 | ZIP | 78701 |
| 2 | Length | 5 |
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.