LEN Function

Counts the characters in a text value, spaces included.

Category

Text

Available in

All versions, Microsoft 365

Returns

A number

Taught hands-on in Level 3: Intermediate Lookups & Data Summaries - Text Functions module

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

ArgumentRequired?What it does
textYesThe 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)
AB
1CodeLength
2WST-10428
3EST-2217
4NTH-008719
=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
AB
1TitleWords
2Quarterly sales review3
3Budget1
4Northstar team meeting notes4
=LEN(TRIM(A2))-LEN(SUBSTITUTE(TRIM(A2), " ", ""))+1 Explain
  1. TRIM removes extra spaces so each gap counts once.
  2. SUBSTITUTE strips every space; the difference in length is the number of spaces.
  3. 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

Kyle Stott

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.