Counting number of time a character appears in a string

H

Henrik

Does anyone know a way to automatically count how many times a certain
character counts in a text string?
 
H

Henrik

I meant to say:

Does anyone know a way to automatically count how many times a certain
character appears in a text string?

(i.e. "w" appears 3 times in the string above)
 
H

Harlan Grove

Henrik wrote...
Does anyone know a way to automatically count how many times a certain
character counts in a text string?

To count the number of Xs in s, try

=LEN(s)-LEN(SUBSTITUTE(s,"X",""))
 
P

Peo Sjoblom

=LEN(A1)-LEN(SUBSTITUTE(A1,"a",""))

will count the occurrence of a in cell A1, if you have a range with strings
use

=SUMPRODUCT((LEN(A1:A10)-LEN(SUBSTITUTE(A1:A10,"a",""))))
 
R

Ron Rosenfeld

Does anyone know a way to automatically count how many times a certain
character counts in a text string?

To count the number of appearances of a character in a text string:

=LEN(A1)-LEN(SUBSTITUTE(A1,char_to_count,""))


--ron
 
Top