Counting number of time a character appears in a string

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Does anyone know a way to automatically count how many times a certain
character counts in a text string?
 
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)
 
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",""))
 
=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",""))))
 
FYI, I figured it out:

=LEN(cell_ref)-LEN(SUBSTITUTE(cell_ref,"character",""))
 
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top