Formula to test if a cell is equal to "0" and not blank

DHeshMan

New Member
Joined
Feb 4, 2015
Messages
3
I have a challenge to come up with the simplest way to test if a cell is equal to 0.

If I use A1=0, I get a TRUE response if the cell is 0 or if it is blank. If I use A1="0", I get a FALSE when it should be TRUE. I hoping to find something simpler than having to use a compound statement like AND(A1=0, NOT(ISBLANK(A1)))

Thanks
 

Excel Facts

Bring active cell back into view
Start at A1 and select to A9999 while writing a formula, you can't see A1 anymore. Press Ctrl+Backspace to bring active cell into view.
Welcome to the board.

Your first solution is the shortest. When you enter quotes around a number, the formula is looking for a text value. That's why it evaluates to FALSE.
 
Upvote 0
You have to do the AND, because IF (and many other Excel functions) treat blanks as 0's..

I'd suggest
=AND(A1=0,ISNUMBER(A1))
 
Upvote 0
You have to do the AND, because IF (and many other Excel functions) treat blanks as 0's..

I'd suggest
=AND(A1=0,ISNUMBER(A1))

Sorry, misread the question. didn't realize you wanted to differentiate between blank and 0....
 
Upvote 0
You could do this instead of the AND

=A1&""="0"

This is what i was trying to do. Looks like this is the simplest route but to avoid confusion later i will add some explicit order of operations. =(""&A1)="0"

I had tried using the command TEXT(A1,"#") to convert the number to a string, but that resulted in a blank string when A1 was 0. ""&A1 treats it like a string inherently. Thanks.
 
Upvote 0

Forum statistics

Threads
1,213,560
Messages
6,114,304
Members
448,564
Latest member
ED38

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