View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.misc
Lars-Åke Aspelin[_2_] Lars-Åke Aspelin[_2_] is offline
external usenet poster
 
Posts: 913
Default Count Instances of a Specific Character

On Mon, 10 Aug 2009 14:45:52 -0700 (PDT), Commish
wrote:

here's what I am trying to do - I am trying to split up a cell based
on it's contents. While the data is in the same order in the column
and it is delimited by a space, it doesn't work to delimit it by
spaces or by number of charatcers.

The problem is that between the delimiters there may be 1 or 2 words -
separated by a comma and the data may be of variable length.

Is there a way to Count the Instances of a Specific Character - for
example, is there a function to count the number of spaces in this
sentence? Or the number of x's?



Try this formula:

=SUMPRODUCT(--(MID(A1,ROW(OFFSET($A$1,,,LEN(A1))),1)="x"))

The result should be the number of x's in cell A1.

Hope this helps / Lars-Åke