LEN Function
Counts the characters in a text value, spaces included.
Category
Text
Available in
All versions, Microsoft 365
Returns
A number
Overview
LEN tells you how long a piece of text is. Every letter, digit, space and punctuation mark counts as one.
On its own it's a quick data-quality check. Inside other formulas it powers “everything after the dash”, word counts and character counts.
Syntax
=LEN(text) Explain
Arguments
| Argument | Required? | What it does |
|---|---|---|
| text | Yes | The text or cell to measure. Numbers are measured as they're stored, not as formatted. |
Examples
Example 1 — Spotting bad product codes
Every Northstar code should be 8 characters long. LEN shows the ones that aren't.
B2fx=LEN(A2)
| A | B | |
|---|---|---|
| 1 | Code | Length |
| 2 | WST-1042 | 8 |
| 3 | EST-221 | 7 |
| 4 | NTH-00871 | 9 |
=LEN(A2) Explain
Turn it into a flag: =IF(LEN(A2)<>8, "Check", "OK").
Example 2 — Counting words
Count the words in each meeting title: the number of spaces plus one.
B2fx=LEN(TRIM(A2))-LEN(SUBSTITUTE(TRIM(A2), " ", ""))+1
| A | B | |
|---|---|---|
| 1 | Title | Words |
| 2 | Quarterly sales review | 3 |
| 3 | Budget | 1 |
| 4 | Northstar team meeting notes | 4 |
=LEN(TRIM(A2))-LEN(SUBSTITUTE(TRIM(A2), " ", ""))+1 Explain
- TRIM removes extra spaces so each gap counts once.
- SUBSTITUTE strips every space; the difference in length is the number of spaces.
- Words = spaces + 1.
Common mistakes
- Invisible spaces count. "Ana " has a length of 4. If two codes look identical but LEN disagrees, a stray space is usually why — TRIM fixes it.
- Formatted numbers. A cell showing $1,250.00 holds 1250, so LEN returns 4.
Notes
- An empty cell has a length of 0.
- Related functions: TRIM, SUBSTITUTE, LEFT, RIGHT, MID.

Author
Kyle Stott
Certified Microsoft Excel Expert
Kyle has worked professionally with Microsoft Excel for over a decade and has consulted on and taught Excel best practices to over 400 companies across 30+ countries.