Count cells with more than 4 words in the cell

jrake40

New Member
Joined
Nov 22, 2016
Messages
30
Looking for a way to count all the cells in Column A of my spreadsheet that have more than 4 words in the cell. The cell text is variable. Is this possible with VBA?
 

Excel Facts

Select a hidden cell
Somehide hide payroll data in column G? Press F5. Type G1. Enter. Look in formula bar while you arrow down through G.
You could probably do that with a formula, but you should post a sample of your data so we can see what it looks like.

Are all words separated by a space?

You might be able to do it with something like the below formula? Enter it with Ctrl+Shift+Enter, not just Enter.

B1:
Code:
=SUM(IFERROR(SEARCH(" ",MID(TRIM(A1),ROW(INDIRECT("1:"&LEN(TRIM(A1)))),1)),0))+1

or maybe this, B1:

Code:
=LEN(TRIM(A1))-LEN(SUBSTITUTE(TRIM(A1)," ",""))+1
 
Last edited:
Upvote 0
Sorry, I overlooked that you wanted over 4, then try the below formula, just press Enter to enter the formula.

Code:
=IF((LEN(TRIM(A1))-LEN(SUBSTITUTE(TRIM(A1)," ",""))+1)>4,"Yes","No")
 
Upvote 0

Forum statistics

Threads
1,216,030
Messages
6,128,408
Members
449,448
Latest member
Andrew Slatter

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