Count the words in a cell

  • Thread starter Thread starter Elton Law
  • Start date Start date
E

Elton Law

Dear exper
A cell contains a lot of information.
Is it possible to count certan word in a cell please?

Say A1 contains a series of text ....

1. Daily Swing even though Sto is hit high or low
2. Look at Chart pattern
3. Stop at dangerous level

How can I count number of "O" in the cell A1 please?

Thanks
Elton
 
Try this...

=LEN(A1)-LEN(SUBSTITUTE(UPPER(A1),UPPER("O"),""))

Note that SUBSTITUTE is case sensitive.
 
=LEN(A1)-LEN(SUBSTITUTE(A1,"o",""))

It's case sensitive, so if you all "O" or "o", repeat the whole formula
substituting the other case and add the two results:
=(LEN(A1)-LEN(SUBSTITUTE(A1,"o","")))+(LEN(A1)-LEN(SUBSTITUTE(A1,"O","")))

Hope this helps,

Hutch
 
Dear exper
A cell contains a lot of information.
Is it possible to count certan word in a cell please?

Say A1 contains a series of text ....

1. Daily Swing even though Sto is hit high or low
2. Look at Chart pattern
3. Stop at dangerous level

How can I count number of "O" in the cell A1 please?

Thanks
Elton


Try the following formula:

=SUMPRODUCT(--(MID(A1,ROW(1:999),1)="o"))

The 999 in the formula should be any number not less than the number
of characters in the text.
With the given example text, the returned value is 8.

Hope this helps / Lars-Åke
 
To be really sure, make it TRIM(LEFT(UPPER("O")))

To be really super-duper extra sure you might want to use:

CLEAN(TRIM(PROPER(LEFT(UPPER(CHAR(79)),1))))
 
Back
Top