Counting words in cell or range of cells.

tygon4

New Member
Joined
Sep 19, 2002
Messages
2
I am trying to come up with a formula that will allow me to count the number of words in a cell or range of cells e.g.
A1 has text "AB CD"
A2 has text "AB CD EF"
The result I desire is 5. I have tried using countif but havent been able to make it work for me. Do I need a custom function for this? If so any suggestions would be be appreciated.
 

Excel Facts

Who is Mr Spreadsheet?
Author John Walkenbach was Mr Spreadsheet until his retirement in June 2019.
Well as long as you don't use a " " after just one word - e.g. A1 = AB not A1 = AB_ (_ meaning space)

You can count the spaces - so if A1 = AB CD then formula would be =COUNT(" ",A1)+1
 
Upvote 0
=SUMPRODUCT((LEN(TRIM(A1:A10))-LEN(SUBSTITUTE(TRIM(A1:A10)," ",""))))+COUNTA(A1:A10)

where A1:A10 houses the target text values.
 
Upvote 0

Forum statistics

Threads
1,214,978
Messages
6,122,547
Members
449,089
Latest member
davidcom

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top