Count the words in a cell

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
 
T

T. Valko

Try this...

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

Note that SUBSTITUTE is case sensitive.
 
T

Tom Hutchins

=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
 
L

Lars-Åke Aspelin

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
 
B

Bernd P

Try this...

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

Note that SUBSTITUTE is case sensitive.

Hi Biff,

I like that UPPER("O") part :)

Have fun,
Bernd
 
T

T. Valko

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))))
 

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

Top