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

How to fill five years of quarters?
Type 1Q-2023 in a cell. Grab the fill handle and drag down or right. After 4Q-2023, Excel will jump to 1Q-2024. Dash can be any character.

DonkeyOte

MrExcel MVP
Joined
Sep 6, 2002
Messages
9,123
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
 

Aladin Akyurek

MrExcel MVP
Joined
Feb 14, 2002
Messages
85,210
=SUMPRODUCT((LEN(TRIM(A1:A10))-LEN(SUBSTITUTE(TRIM(A1:A10)," ",""))))+COUNTA(A1:A10)

where A1:A10 houses the target text values.
 

Forum statistics

Threads
1,181,108
Messages
5,928,104
Members
436,588
Latest member
mummabare

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
Top