Back to functions
Text2026-03-182 related articles

LEN Function in Excel

Return the number of characters in a text string.

Syntax

LEN(text)

Arguments

text

Required

The text whose length you want to find. Spaces count as characters.

What it returns

Returns the character count of the supplied text.

What LEN does

LEN counts how many characters are in a text value. It is useful for validating input length, finding hidden spaces, and building formulas that depend on text size.

Practical examples

Count characters in a cell

=LEN(A2)

If A2 contains Quarter 1, the result is 9.

Count characters after trimming spaces

=LEN(TRIM(B2))

This is a useful pattern when imported text may contain unwanted leading or trailing spaces.

Common mistakes and notes

LEN counts spaces

Visible spaces and many hidden spacing issues count as characters. That is why LEN is helpful for diagnosing dirty text.

Formatted numbers are counted by stored value

LEN uses the underlying text representation, not how the cell looks after number formatting. Dates and numbers can therefore be surprising.

Use TRIM or CLEAN when counts look too high

Unexpected character counts often come from extra spaces or nonprinting characters in imported data.

Related functions

Related articles

Deep dives, troubleshooting guides, and practical examples that use LEN.

Official documentation