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!
 

Excel Facts

Format cells as currency
Select range and press Ctrl+Shift+4 to format cells as currency. (Shift 4 is the $ sign).
I thought this IF(OR(A1&B1={"00",""}),1,0) will make it, but not, it is more complicated than I initially thought.

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

it is a tricky one! Now, I understand the challenge better.

Thanks!
 
Upvote 0
Yes, there is that. Yours returns 1 if both are blank, which isn't quite correct either.

Back to the drawing board.
 
Upvote 0
=1-OR(COUNTIF(A1:B1,0)<>2,COUNTBLANK(A1:B1)=2)
 
Last edited:
Upvote 0
The op said this:

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!
 
Upvote 0

Forum statistics

Threads
1,214,920
Messages
6,122,264
Members
449,075
Latest member
staticfluids

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