How to differentiate zero from blank?

actjfc

Active Member
Joined
Jun 28, 2003
Messages
416
I have two cells, let’s say, A1 and B1.

They may hold blanks or zeros, I need a way to identify when both are blanks or both are zeros. So, I did this:
D10=(1-(A1=””)*(B1=””))*(A1=0)*(B1=0)

I test it this way:
(A1=”” and B1=””) results in D10 =0, and
(A1=0 and B1=0) results in D10 =1, both results are ok for my project!

But,
Any other combination: A1=0 and B1=”” or A1=”” and B1=0 must result in D10=0, This is my issue, Excels seems to take both "" and 0 as the same. Am I right about it? How Can I get 0 (FALSE) in D10? Where my logic is faulty?

Thanks!
 
Sorry, there is one more case: >0 - >0 must be True. Thanks for any help! I am working on it!

Blank - Blank must be False,
Zero - Zero must be True,
>0 - Blank must be True,
Blank - >0 must be False,
0 - >0 must be False
>0 - >0 must be True
 
Last edited:
Upvote 0

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.
Sorry, there is one more case: >0 - >0 must be True. Thanks for any help! I am working on it!

Blank - Blank must be False,
Zero - Zero must be True,
>0 - Blank must be True,
Blank - >0 must be False,
0 - >0 must be False
>0 - >0 must be True
What about for these which you omitted from your list...

Zero-Blank
Blank-Zero
>0 - 0
 
Upvote 0
=or(and(a1=0,b1=0,count(a1:b1)=2),and(a1>0,b1=""),and(a1>0,b1>0))+0
 
Last edited:
Upvote 0
That function is available on Excel 2013 and higher, but I don't think that addresses the conditions that came later in the thread.
 
Upvote 0
Thanks Rick Rothstein! You are right! I missed them!

Zero-Blank - False
Blank-Zero - False
>0 - 0 - True

I am so sorry, I corrected this one : >0 - Blank must be False.
 
Upvote 0
Thanks Rick Rothstein! You are right! I missed them!

Zero-Blank - False
Blank-Zero - False
>0 - 0 - True

I am so sorry, I corrected this one : >0 - Blank must be False.
I believe this formula will work for you...

=0+OR(A1&B1="00",AND(A1>0,B1<>""))
 
Upvote 0

Forum statistics

Threads
1,224,824
Messages
6,181,187
Members
453,020
Latest member
Mohamed Magdi Tawfiq Emam

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