Count a cell if it contains either a blank OR "n/a" anywhere in the cell OR any number of spaces

taniab

New Member
Joined
Jun 8, 2015
Messages
42
I'm looking at cells in P215-W215.

I want to exclude cells if the contain
1 space
2 spaces
3 spaces
4 spaces
5 spaces
a "0"
or the words "n/a" anywhere in the cell.

I want to count all other cells. So for row 1 in the pic, it should return 5
For row 2 in the pic it should return 4
For row 3 it should return 6

The empty cell is picking up data, it looks blank but it contains any number of spaces, so I want to exclude it from the count

I have this formula, but it's so messy and not doing what I want it to.
=((COUNTIF(P51:W51,"*"&"")))-((COUNTIF(U51," ")+COUNTIF(U51," ")+COUNTIF(U51," ")+COUNTIF(U51," ")+COUNTIF(U51," "))+(COUNTIF(U51," ")+COUNTIF(V51," ")+COUNTIF(V51," ")+COUNTIF(V51," ")+COUNTIF(V51," "))+(COUNTIF(W51," ")+COUNTIF(W51," ")+COUNTIF(W51," ")+COUNTIF(W51," ")+COUNTIF(W51," "))+(COUNTIF(P51," ")+COUNTIF(P51," ")+COUNTIF(P51," ")+COUNTIF(P51," ")+COUNTIF(P51," "))+(COUNTIF(Q51," ")+COUNTIF(Q51," ")+COUNTIF(Q51," ")+COUNTIF(Q51," ")+COUNTIF(Q51," "))+(COUNTIF(R51," ")+COUNTIF(R51," ")+COUNTIF(R51," ")+COUNTIF(R51," ")+COUNTIF(R51," "))+(COUNTIF(S51," ")+COUNTIF(S51," ")+COUNTIF(S51," ")+COUNTIF(S51," ")+COUNTIF(S51," "))+(COUNTIF(T51," ")+COUNTIF(T51," ")+COUNTIF(T51," ")+COUNTIF(T51," ")+COUNTIF(T51," ")))
 

Attachments

  • Capture.JPG
    Capture.JPG
    43.8 KB · Views: 3

Excel Facts

How can you automate Excel?
Press Alt+F11 from Windows Excel to open the Visual Basic for Applications (VBA) editor.
Sorry, rows are P51-T51

I also want to exclude the count if it has this text


n/a n/a n/a n/a n/a
 
Upvote 0

Forum statistics

Threads
1,214,929
Messages
6,122,317
Members
449,081
Latest member
tanurai

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