Newbie: Counting the number of words in a column

C

CF

Is it possible to count the number of words in a column with approximately
5000
records using a built-in function? Any help would be appreciated. Thanks in
advance...Carlos
 
F

Frank Kabel

Hi
try
=SUMPRODUCT((LEN(A1:A5000)-LEN(SUBSTITUTE(A1:A5000,"
","")+1)*(A1:A5000<>""))
 
H

Harlan Grove

As a noob, you should first try searching google groups for such a thing..

http://tinyurl.com/34jqy
...

That'd prevent some of us from improving on past work.

=SUMPRODUCT(LEN(TRIM(Rng))-LEN(SUBSTITUTE(TRIM(Rng)," ","")))+COUNTA(Rng)

This also treats hyphenated words as one word and nonword tokens as words.
Counting words more strictly defined requires VBA if it's to be done robustly.
 
H

Harlan Grove

try
=SUMPRODUCT((LEN(A1:A5000)-LEN(SUBSTITUTE(A1:A5000,"
","")+1)*(A1:A5000<>""))
...

You should try it. It produces incorrect results if there are two or more spaces
in sequence or any trailing spaces anywhere in the range.
 
F

Frank Kabel

Harlan said:
...
..

You should try it. It produces incorrect results if there are two or
more spaces in sequence or any trailing spaces anywhere in the range.

Hi Harlan
should have added TRIM (as you did in your post). Thanks for the
correction
frank
 

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