Use the LEN function: =LEN(A2) returns the number of characters in cell A2, including spaces.
=LEN(A2)
You often need to know how many characters are in a cell, for example to fit text into a form field, check a tweet length, or make sure product codes are exactly 8 characters. Excel's LEN function counts every character, including spaces and punctuation.
Step by step
- Click the cell where you want the count to appear.
- Type =LEN(A2) and press Enter. Replace A2 with the cell that holds the text.
- The result is the number of characters in that cell.
- To count characters for a whole column, drag the fill handle down from the first result.
- If you also want to count characters in several cells together, use =SUMPRODUCT(LEN(A2:A10)).
Try it here
Examples
1 Count characters in one cell
LEN returns the number of characters in the text, including spaces. For 'Hello world' the result is 11 because the space is counted.
| A | B | C | D | |
|---|---|---|---|---|
| 1 | Text | |||
| 2 | Hello world | 11 | ||
| 3 | Excel | |||
| 4 | 12345 | |||
| 5 | a b c | |||
| 6 |
=LEN(A2)2 Count characters for a list of cells
Copy the formula down to get the character count for each row. The formula in C2 counts A2, C3 counts A3, and so on.
| A | B | C | D | |
|---|---|---|---|---|
| 1 | Product code | |||
| 2 | AB123 | 5 | ||
| 3 | X98765 | |||
| 4 | Q1 | |||
| 5 | TEST-01 | |||
| 6 |
=LEN(A2)3 Count characters in a range
SUMPRODUCT with LEN adds up the character counts of all cells in the range. It returns the total number of characters in A2:A5.
| A | B | C | D | |
|---|---|---|---|---|
| 1 | Notes | |||
| 2 | Apple | 21 | ||
| 3 | Banana | |||
| 4 | Cherry | |||
| 5 | Date | |||
| 6 |
=SUMPRODUCT(LEN(A2:A5))Other ways to do it
| Formula | Use it when |
|---|---|
=LEN(TRIM(A2)) | Use when you want to ignore extra spaces at the start or end of the text. |
=LEN(A2)-LEN(SUBSTITUTE(A2," ","")) | Use to count only the spaces in a cell. |
Practise it
Free exercises with instant feedback. No sign-up needed.
Common mistakes
- The count seems too high because of trailing spaces. Use =LEN(TRIM(A2)) to remove extra spaces before counting, or clean the data with TRIM.
- LEN returns a number but you expected text. LEN always returns a number. If you need to display it with text, combine it like ="Characters: "&LEN(A2).
- The formula shows #NAME? because the function name is misspelled. Check that you typed =LEN( with an opening parenthesis and closed it properly.
Questions people also ask
Does LEN count spaces?
Yes, LEN counts every character including spaces, punctuation, and numbers.
How do I count characters in a whole column?
Use =SUMPRODUCT(LEN(A2:A100)) to get the total for a range, or copy =LEN(A2) down beside your data.
Can I count characters without spaces?
Yes, use =LEN(SUBSTITUTE(A2," ","")) to remove spaces before counting.
Functions used
Every formula on this page was checked by SheetSkill’s spreadsheet engine. All how-to guides