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

Is there a shortcut key for strikethrough?
Ctrl+S is used for Save. Ctrl+5 is used for Strikethrough. Why Ctrl+5? When you use hashmarks to count |||| is 4, strike through to mean 5.
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,223,911
Messages
6,175,326
Members
452,635
Latest member
laura12345

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