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?
 
The range had 5 0s generated throgh vlookup formula. So CORRECT ANSWER is 99 but it is giving WRONG ANSWER as 104!!!
 
Upvote 0

Excel Facts

Can Excel fill bagel flavors?
You can teach Excel a new custom list. Type the list in cells, File, Options, Advanced, Edit Custom Lists, Import, OK
I tried. I need something like IFZERO(vlookup,""). Please help
 
Upvote 0
IF(VLOOKUP=0,"",VLOOKUP)[/QUOTE]
I modified like above & used =COUNTIF(C59:C162,"?*")+COUNT(C59:C162)-COUNTIF(C59:C162,""), but still it counts 0 occurrences!!!
 
Upvote 0
Let me ask a foolish question:when do you click on a cell containing 0 what do you see in the formula bar?

M.
 
Upvote 0
Hi,

Another possibility might be that the values are not really zero but some small amount and the formatting makes it look like zero. Perhaps see if this gives you a different answer:

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

If not perhaps post some sample data or post your file on Box.com or SkyDrive and someone might be able to look at it.
 
Upvote 0
Perhaps the formula is returning text. Maybe

=COUNTIF(C59:C162,"?*")+COUNT(C59:C162)-COUNTIF(C59:C162,"0")
COUNTIF evaluates text numbers and numeric numbers as being equal.

COUNTIF(range,0) and COUNTIF(range,"0") are the same.

Book1
A
10
20
30
40
50
Sheet1

A4:A5 have been formatted as text.

=COUNTIF(A1:A5,0) = 5
=COUNTIF(A1:A5,"0") = 5
 
Upvote 0
Hi,

Another possibility might be that the values are not really zero but some small amount and the formatting makes it look like zero. Perhaps see if this gives you a different answer:

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

If not perhaps post some sample data or post your file on Box.com or SkyDrive and someone might be able to look at it.

I also thought in something like this but as =COUNT(C59:C162) returns 0 (see #6) there are no numbers in the range (???)

M.
 
Upvote 0

Forum statistics

Threads
1,226,693
Messages
6,192,464
Members
453,725
Latest member
cvsdatreas

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