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

Format cells as time
Select range and press Ctrl+Shift+2 to format cells as time. (Shift 2 is the @ sign).

DominicB

Well-known Member
Joined
Oct 3, 2005
Messages
1,569
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
 

goosteroo

New Member
Joined
Oct 28, 2005
Messages
42
I used the sumproduct, although the calculations take longer.

=COUNTIF(A1:G1,"<>")-COUNTIF(A1:G1,0) didn't work for me.
 

Scott Huish

MrExcel MVP
Joined
Mar 17, 2004
Messages
19,958
Office Version
  1. 365
  2. 2010
Platform
  1. Windows

ADVERTISEMENT

How didn't the COUNTIF formula work?
Book2
ABCDEFGH
1100233
Sheet1
 

barry houdini

MrExcel MVP
Joined
Mar 23, 2005
Messages
20,825
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")
 

Aladin Akyurek

MrExcel MVP
Joined
Feb 14, 2002
Messages
85,209
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)
 

Forum statistics

Threads
1,137,366
Messages
5,681,068
Members
419,950
Latest member
BeckiJae

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