countifs blank zeros.

cud22

New Member
Joined
Jan 25, 2010
Messages
24
Have spent the last two hours losing the plot trying to find why a countifs is returning unexpected result, then discovered that countifs treats blanks and zeros the same...

One of the columns i am using in the countifs has both blanks and zeros that i need to differentiate. How would you do this?

Unfortunately I do not have control over the data, and simply amending the data to fix wont work as the data will be constantly reloaded....

Example column in a1
Data
0
1
2
3
0
1
2
3

<colgroup><col></colgroup><tbody>
</tbody>

Calculation example in c1

Countifs CriteriaResult
2=COUNTIFS(Sheet1!$A$4:$A$13,Sheet1!$C4)
02
12
22
32
990

<colgroup><col><col><col></colgroup><tbody>
</tbody>

Changing a zero to 99 in the data table reduces the result of the countifs formula for both blank and zero, how can i avoid this?

PS, this is just an example table, in the original spreadsheet the countifs is looking at 4 fields, one of which contains blanks, zero's and positive integers; all others contain text and blanks.
 

Excel Facts

What is the shortcut key for Format Selection?
Ctrl+1 (the number one) will open the Format dialog for whatever is selected.
With "Data" in A1 and "Countifs criteria" in C1

Use this formula instead

=SUMPRODUCT((A$2:A$11=C2)*(LEN(A$2:A$11)=LEN(C2)))
 
Upvote 0
Thanks,that works as expected.

Was going round in circles finding the error in my formula / data before realising there was no error and the countifs formula was working as designed (but not as expected by me....!
 
Upvote 0

Forum statistics

Threads
1,214,943
Messages
6,122,369
Members
449,080
Latest member
Armadillos

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