To count how many times a character appears in a cell, measure the text, remove that character, and measure it again: =LEN(A1)-LEN(SUBSTITUTE(A1,"e","")). The difference is your count. SUBSTITUTE is case-sensitive, so this counts lowercase “e” only — to count both cases, wrap the cell in UPPER: =LEN(A1)-LEN(SUBSTITUTE(UPPER(A1),"E","")).
For a word or a multi-character string rather than a single letter, divide by its length: =(LEN(A1)-LEN(SUBSTITUTE(A1,"the","")))/LEN("the"). To count across a whole column, wrap it in SUMPRODUCT: =SUMPRODUCT(LEN(A1:A10)-LEN(SUBSTITUTE(A1:A10,"e",""))). And to point at a cell instead of typing the character in, drop the quotes: =LEN(A1)-LEN(SUBSTITUTE(A1,C1,"")).
In Excel, to count a specific character, you need to use a combination of SUBSTITUTE and LEN functions.
LEN counts the total characters, and then the SUBSTITUTE function removes the character that you want to count from the main value.
After that, you can again count the total characters and compare them with the original count to get the count of that specific character.
In the following example, you have a long sentence in cell A1, and now, from the sentence, you need to count how many times the letter “e” occurred. We will write this formula in cell B1.

You can use the following steps to write this formula:
- First, in cell B1, enter the LEN function and refer to cell A1.
- After that, enter a minus sign and enter the LEN function again.
- Next, you need to enter the SUBSTITUTE function within the LEN function.
- Now, in the SUBSTITUTE function, refer to cell A1 again.
- From here, you need to specify the character you want to replace in the second argument (“e”).
- Then, enter a blank value (“”) in the third argument of the SUBSTITUTE function.
- In the end, type the closing parentheses and hit enter.

The moment you hit enter, it returns the count of the character “e” in the result, which is twenty-four.
=LEN(A1)-LEN(SUBSTITUTE(A1,"e",""))
Keep in mind that SUBSTITUTE is case-sensitive, so this formula counts only the lowercase “e” and skips “E”. To count both, convert the text to lowercase with LOWER first:
=LEN(A1)-LEN(SUBSTITUTE(LOWER(A1),"e",""))

To verify this formula, I ran the following code, which loops through all the characters in cell A1.
Sub LoopString() Dim Counter As Integer Dim MyString As String Dim i As Integer MyString = Range("A1").Value For Counter = 1 To Len(MyString) If Mid(MyString, Counter, 1) = "e" Then i = i + 1 End If Next MsgBox i End Sub
Read Also – Count Cells by Color in Excel
How This Formula Works
Now it is time to understand how this formula works, and for this, we need to split this formula into three parts.

- In the first part, the LEN function counts the total number of characters from cell A1 and returns 199 in the result.
- In the second part, we used the SUBSTITUTE function to replace “e” with nothing (a blank value).
- In the third part, we have wrapped the SUBSTITUTE function in LEN to count the characters of the value where the character “e” is not there. The difference between the first and the third part is the number of times “e” appears.

Count a Character from a Cell Reference
Instead of typing the character in the formula, you can enter it in a cell (B1) and refer to that cell. This way, you can change the character without editing the formula:
=LEN(A1)-LEN(SUBSTITUTE(A1,B1,""))
Count a Character in a Range of Cells
To count a character in all the cells of a range, use the same logic inside SUMPRODUCT, which adds up the count from each cell:
=SUMPRODUCT(LEN(A1:A10)-LEN(SUBSTITUTE(A1:A10,"e","")))
Count a Word or a Group of Characters
When you count more than one character, like “ee”, the difference in length is two characters for each match. So, divide the result by the length of the text you are counting (here in cell C1):
=(LEN(A1)-LEN(SUBSTITUTE(A1,C1,"")))/LEN(C1)
For counting whole words in a cell, see Count Words in Excel.
Frequently Asked Questions
Why does my formula miss capital letters?
SUBSTITUTE is case-sensitive, so “e” doesn’t match “E”. Wrap the cell in LOWER (or UPPER, with an uppercase character) to count both.
How do I count spaces in a cell?
Use a space as the character to remove, like =LEN(A1)-LEN(SUBSTITUTE(A1,” “,””)). This counts every space, including spaces at the start or end of the text.
Can I count a character in numbers?
Yes. LEN and SUBSTITUTE treat a number as text, so you can count a digit, like “5”, in the same way. Note that they work on the stored value, not the formatting, so a thousands separator or a currency sign shown by the number format isn’t counted.
Written by
Puneet Gogia
Microsoft MVP — Excel · Founder, Excel Champs
Twelve years of teaching Excel, and a decade before that using it as a data analyst. Every tutorial here is written from a file I actually built.