To count characters in an Excel cell, use =LEN(A1). It returns the number of characters in A1, including spaces, punctuation and line breaks. That one function is the building block for almost every other counting task — characters without spaces, a specific letter, whole columns, and even words.
All formulas below work in Excel for Microsoft 365, Excel 2016–2024, Excel for Mac, and Google Sheets. If you only need a quick count of a block of text, it is faster to paste it into the Character Counter, which shows characters, words, sentences and spaces at once.
Count all characters in a cell
=LEN(A1)
LEN counts every character: letters, digits, spaces, punctuation, and line breaks created with Alt + Enter. For "Hello world" it returns 11.
Watch out for invisible extras. Data pasted from websites or exported from other systems often has leading or trailing spaces, so a cell that looks like "Hello" may return 6. To count without those:
=LEN(TRIM(A1))
TRIM removes spaces at the start and end and collapses double spaces between words into one. It does not remove non-breaking spaces (character 160) that come from web pages. For those, use:
=LEN(TRIM(SUBSTITUTE(A1,CHAR(160)," ")))
Count characters without spaces
Replace every space with nothing, then measure what is left:
=LEN(SUBSTITUTE(A1," ",""))
This is useful for forms, academic limits and platforms that state their limit "excluding spaces". For background on when each version is used, see our guide to character count with and without spaces.
Count how many times a specific character appears
Measure the text, remove the character, and subtract:
=LEN(A1)-LEN(SUBSTITUTE(A1,"a",""))
SUBSTITUTE is case-sensitive, so this counts lowercase "a" only. To count "a" and "A" together, convert to one case first:
=LEN(A1)-LEN(SUBSTITUTE(LOWER(A1),"a",""))
To count a word or longer string (for example, how many times "red" appears), divide by its length:
=(LEN(A1)-LEN(SUBSTITUTE(A1,"red","")))/LEN("red")
Note that this also counts "red" inside "covered" or "reduced". For whole words, add spaces around the search term and the text.
Count characters in a whole column or range
=SUMPRODUCT(LEN(A1:A100))
SUMPRODUCT works in every version of Excel and in Google Sheets. In Excel 365 and Google Sheets you can also write =SUM(LEN(A1:A100)), because both handle arrays natively.
To count how many times a character appears across a range:
=SUMPRODUCT(LEN(A1:A100)-LEN(SUBSTITUTE(A1:A100,",","")))
Count words in a cell
Excel has no WORDCOUNT function, but you can count the spaces between words and add one:
=IF(LEN(TRIM(A1))=0,0,LEN(TRIM(A1))-LEN(SUBSTITUTE(TRIM(A1)," ",""))+1)
In Excel 365 there is a cleaner option using TEXTSPLIT:
=IF(TRIM(A1)="",0,COUNTA(TEXTSPLIT(TRIM(A1)," ")))
In Google Sheets:
=IF(TRIM(A1)="",0,COUNTA(SPLIT(TRIM(A1)," ")))
Flag cells that are over a character limit
Character limits are a common reason to count in a spreadsheet: product titles for marketplaces, meta descriptions, ad headlines, SMS templates. Two practical approaches:
A check column. In B1, enter =LEN(A1) and in C1 enter =IF(LEN(A1)>160,"Too long","OK"), then fill down.
Conditional formatting. Select the column, choose Home → Conditional Formatting → New Rule → Use a formula, and enter:
=LEN(A1)>60
Pick a red fill, and every cell over 60 characters is highlighted as you type. Change 60 to whatever limit you work with — for example 30 for Google Ads headlines or 160 for SMS messages.
Quick reference
| Task | Formula |
|---|---|
| All characters | =LEN(A1) |
| Without leading/trailing spaces | =LEN(TRIM(A1)) |
| Without any spaces | =LEN(SUBSTITUTE(A1," ","")) |
| Specific character (case-sensitive) | =LEN(A1)-LEN(SUBSTITUTE(A1,"x","")) |
| Specific character (any case) | =LEN(A1)-LEN(SUBSTITUTE(LOWER(A1),"x","")) |
| Total in a range | =SUMPRODUCT(LEN(A1:A100)) |
| Words in a cell | =IF(LEN(TRIM(A1))=0,0,LEN(TRIM(A1))-LEN(SUBSTITUTE(TRIM(A1)," ",""))+1) |
| Over a limit? | =LEN(A1)>160 |
Things that can surprise you
- Emoji count as 2. Excel's
LENcounts UTF-16 code units, so most emoji return 2. That matches how many websites count, but not how a person would. - Numbers are counted as displayed values.
LENmeasures the underlying value, not the formatting. A cell showing "$1,250.00" with the value 1250 returns 4. - The cell limit is 32,767 characters. Text beyond that is cut off when pasted into a cell.
LENBis different. In Excel set to a double-byte language (Chinese, Japanese, Korean),LENBcounts bytes, where those characters count as 2. In other setups it behaves likeLEN.
Frequently asked questions
What is the formula to count characters in Excel?
=LEN(A1) counts all characters in cell A1, including spaces.
How do I count characters without spaces in Excel?
Use =LEN(SUBSTITUTE(A1," ","")).
Does Google Sheets use the same formula?
Yes. LEN, TRIM, SUBSTITUTE and SUMPRODUCT work the same way in Google Sheets.
How can I count characters in many cells at once?
Use =SUMPRODUCT(LEN(A1:A100)) for a total, or put =LEN(A1) in a helper column and fill it down for per-cell counts.
Final takeaway
LEN does the counting; TRIM, SUBSTITUTE and SUMPRODUCT shape what gets counted. For one-off checks of a paragraph, caption or title, paste it into the Character Counter and you will see characters, words and spaces without writing a formula.