In a spreadsheet I’m using, some of the possibilities for a cell is being blank, having the number zero, or having a non-zero number, or having a string.
If I want to test if the cell is zero, but is not blank, I currently do
=IF(AND(B2=0,LEN(B2)>0),foo,bar)
Is there a way of replacing the two conditionals with one conditional?
The function you are looking for is the ISBLANK() function.
=IF(AND(ISBLANK(A1)=FALSE,A1=0),”foo”,”bar”)
EDIT:
Sorry I just re-read your question. You’re forced to use 2 conditionals because you’re checking for two conditions. If you wanted to just use one condition for whatever reason the only way that I can think of is to extract the conditions you are checking into a method and then call it.
So, it becomes
=IF(CheckCellIsOK(A1),”foo”,”bar”)
The method still checks both conditions but you’re just hiding that fact.