number of spaces...

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

Guest

Hello.

I know someone showed me this before, but I've forgotten.

If I wanted to do a count of the number of spaces within a single cell, how
could I do that?

For instance, if I wanted to look at a cell that contained 'A B C D', and
get the answer that there are three spaces in that.

Thanks.
Mark
 
=(len(a1)-len(substitute(a1," ","")))/len(" ")

Since you're only counting a single character, you could eliminate the
denominator:

=len(a1)-len(substitute(a1," ",""))
 
Back
Top