Text function
Excel LEN function
LEN counts how many characters are in a cell, including spaces and punctuation. Use it to check that IDs are the right length, find hidden spaces, or work out how much text to pull with LEFT or RIGHT.
=LEN(text)Arguments
text- The text or cell to count. Numbers are counted as they would be written out.
LEN examples
Every result below was calculated from this sample sheet by the same spreadsheet engine the Cellwise app uses.
| A | B | C | |
|---|---|---|---|
| 1 | Username | Zip | Tweet draft |
| 2 | jsmith | 02139 | Big launch today! Check out our new spring line. |
| 3 | maria.gonzalez | 9021 | Thanks for 10k followers |
| 4 | tk | 60614 | Store closed Monday. |
Result: 6
Counts the letters in "jsmith": 6.
Result: Check zip
US zip codes have 5 digits, so the 4-character "9021" gets flagged.
Result: 1
Counts the extra spaces TRIM would remove. Here there is 1 trailing space.
Result: 232
Shows how many characters are left before a 280-character limit.
How to use LEN
- Click the cell for the count.
- Type =LEN( and select the cell to measure.
- Close the bracket.
- Use the result in IF, LEFT, RIGHT or MID as needed.
Common LEN mistakes
Forgetting that spaces count
LEN includes every space, including invisible ones at the end. Compare with LEN(TRIM(A2)) to spot them.
Measuring formatted numbers
LEN counts the stored value, not what you see. 5.00 shown with two decimals counts as 1 character.
LEN FAQ
How do I count characters in a cell in Excel?
Use =LEN(A2). It counts letters, digits, spaces and punctuation.
How do I count characters without spaces in Excel?
Remove the spaces first: =LEN(SUBSTITUTE(A2," ","")).
How do I count how many times a character appears in a cell?
Subtract the length without it: =LEN(A2)-LEN(SUBSTITUTE(A2,",","")) counts the commas.
Practice LEN in these lessons
Guides that use LEN
- How to remove spaces in Excel
- How to capitalize the first letter in Excel
- How to remove characters from a cell in Excel
Related functions
TRIMRemoves extra spacesLEFTCharacters from the startRIGHTCharacters from the endSUBSTITUTEReplaces text
Updated