Count no. of occurences without counting ZEROES

hsandeep

Well-known Member
Joined
Dec 6, 2008
Messages
1,226
Office Version
  1. 2010
Platform
  1. Windows
  2. Mobile
I am counting 'no. of values' by using formula =COUNTIF(C59:C162,"?*")+COUNT(C59:C162).
But it also counts 0 (zero). I want that it should not count 0s occurred in cells.
How to accomplish?
 

Excel Facts

What did Pito Salas invent?
Pito Salas, working for Lotus, popularized what would become to be pivot tables. It was released as Lotus Improv in 1989.
I tried. But still your formula counted 0s occurred in the range!!!
 
Upvote 0
I tried. But still your formula counted 0s occurred in the range!!!

The formula Andrew suggests should succeed. What is the result that you get with it and do the follwing return?

=COUNTIF(C59:C162,"?*")

=COUNT(C59:C162)

=COUNTIF(C59:C162,0)

=SUMPRODUCT((C59:C162=0)+0)
 
Upvote 0
Hi

Can you post a sample of your data?

You should always post a sample of your data, that we can use for testing. It makes it easier to avoid misunserstandings.
 
Upvote 0
=COUNTIF(C59:C162,"?*") 104 (All 104 cells had values & not equal to 0).

=COUNT(C59:C162) Answer=0


=COUNTIF(C59:C162,0)
Answer=0
=SUMPRODUCT((C59:C162=0)+0) Answer=0
 
Upvote 0
=COUNTIF(C59:C162,"?*") 104 (All 104 cells had values & not equal to 0).

=COUNT(C59:C162) Answer=0


=COUNTIF(C59:C162,0)
Answer=0
=SUMPRODUCT((C59:C162=0)+0) Answer=0

So no numbers, 0 included.

Conclusion:

=COUNTIF(C59:C162,"?*")+COUNT(C59:C162)-COUNTIF(C59:C162,0)

Andrew suggested will/must return: 104.
 
Upvote 0
I am getting 0s in the cells through formula generated. Can this be the reason that the formula is NOT WORKING?
 
Upvote 0
Perhaps the formula is returning text. Maybe

=COUNTIF(C59:C162,"?*")+COUNT(C59:C162)-COUNTIF(C59:C162,"0")
 
Upvote 0
NO. It is still counting 0 occurences in the cells. These 0s are generated through vlookup formulas.
 
Upvote 0

Forum statistics

Threads
1,223,239
Messages
6,170,947
Members
452,368
Latest member
jayp2104

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