COUNTIF for 0s and blanks

goosteroo

New Member
Joined
Oct 28, 2005
Messages
42
Hi, I have a formula that's supposed to count only if the cell doesn't include a "0" or a blank.

=COUNTIF(A1:G1,AND("<>0","<>"""))


The row looks like this

A B C E F G
1 0 0 2 3


This formula doesn't work. Can someone please help?

Many thanks in advance.
 

Excel Facts

Why does 9 mean SUM in SUBTOTAL?
It is because Sum is the 9th alphabetically in Average, Count, CountA, Max, Min, Product, StDev.S, StDev.P, Sum, VAR.S, VAR.P.
Good morning goosteroo

How about this :

=SUMPRODUCT(--(Sheet1!$A$1:$F$1<>0),--(Sheet1!$A$1:$F$1<>""))

To construct formulae like this to conditionally add / count cells with up to 6 conditions you can download my add in via the link below which has a Multiple SumIf Generator - it builds the formulae on the screen as you specify the conditions.

HTH

DominicB
 
Upvote 0
I used the sumproduct, although the calculations take longer.

=COUNTIF(A1:G1,"<>")-COUNTIF(A1:G1,0) didn't work for me.
 
Upvote 0
I assume you have "formula blanks" in the range......

of course, given your example, if you only have zeroes, positive numbers or blanks

=COUNTIF(A1:G1,">0")
 
Upvote 0
Hi, I have a formula that's supposed to count only if the cell doesn't include a "0" or a blank.

=COUNTIF(A1:G1,AND("<>0","<>"""))


The row looks like this

A B C E F G
1 0 0 2 3


This formula doesn't work. Can someone please help?

Many thanks in advance.

Given your sample...

=COUNT(A1:G1)-COUNTIF(A1:G1,0)
 
Upvote 0

Forum statistics

Threads
1,217,328
Messages
6,135,917
Members
449,972
Latest member
Natejack

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