Link to home
Start Free TrialLog in
Avatar of Steve_Brady
Steve_BradyFlag for United States of America

asked on

Count specific characters in a cell or range in Excel

Hello,

When using Excel (2007), =COUNTIF() counts the number of CELLS in a given range which match a specific criteria.  Also, =LEN() counts the number of CHARACTERS in a given cell.

Is there a function or formula that will count the number of times a defined CHARACTER occurs in a cell or range?  For example:

Suppose A1 contained some text:  

"Mary had a little lamb whose fleece was white as snow."

Now, suppose you want to be able to enter some letter in B1 and have C1 display how many times that letter occurs in A1, i.e.

for B1 = a,  C1 = 6
for B1 = b,  C1 = 1
for B1 = e,  C1 = 6
for B1 = s,  C1 = 4
and so on.

How would you do that?

Thanks
ASKER CERTIFIED SOLUTION
Avatar of cyberkiwi
cyberkiwi
Flag of New Zealand image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Range:  =SUMPRODUCT(LEN(A1:A4)-LEN(SUBSTITUTE(A1:A4,B1:B4,"")))

Where A1-A4 contain the texts, B1-B4 contain the letters