Excel function

LENfunction

Counts the characters in a text. A space counts as one character.

All versions
=LEN("New York City")

Text13 chars

1N1
2e2
3w3
4·4
5Y5
6o6
7r7
8k8
9·9
10C10
11i11
12t12
13y13

Add a space at the start or end of the text. You can't see it, but the count goes up. Try breaking it on purpose to see the errors.

Result

13

text

The text whose characters you count. Spaces count as characters.

What is the LEN function?

=LEN(text)

LEN counts the characters in a text. It is often used to check input length or to work out character counts for other text functions.

Spaces count as characters. Invisible spaces at the start or end make LEN larger than expected, so check with LEN first when data looks odd.

Arguments

text
The text or cell whose characters you count. For a number, it counts the digits.

LEN examples

  1. Example 1. Length of a city name

    =LEN("New York City")

    11 letters and 2 spaces: 13.

  2. Example 2. A blank cell

    =LEN(A2)

    If A2 is empty, 0.

  3. Example 3. How many extra spaces

    =LEN(A2)-LEN(TRIM(A2))

    The number of spaces TRIM would remove.

Common mistakes

FAQ

Are line breaks counted?
A line break inside a cell (Alt+Enter) counts as one character.
How often does a character appear?
Subtract the length without it: =LEN(A2)-LEN(SUBSTITUTE(A2,"-","")).