Excel - if the cell is not empty, then the IF statement

I have this simple statement in excel . I am comparing two dates. If date 2 is greater than or equal to date 1, I display 1 . If not, then I show 0 .

However, I would like to apply this function only when cells contain text:

 IF(NOT(ISBLANK((Q2<=R2;"1";"0"))) 

It gives me an error - what am I doing wrong?

+6
source share
2 answers

Your formula is wrong. You probably meant something like:

 =IF(AND(NOT(ISBLANK(Q2));NOT(ISBLANK(R2)));IF(Q2<=R2;"1";"0");"") 

Another equivalent:

 =IF(NOT(OR(ISBLANK(Q2);ISBLANK(R2)));IF(Q2<=R2;"1";"0");"") 

Or even shorter:

 =IF(OR(ISBLANK(Q2);ISBLANK(R2));"";IF(Q2<=R2;"1";"0")) 

OR EVEN SHORTER:

 =IF(OR(ISBLANK(Q2);ISBLANK(R2));"";--(Q2<=R2)) 
+10
source

You need to use the AND statement in your formula

= IF (AND (IF (NOT (QUST (Q2)); TRUE; FALSE); Q2 <= R2); "1", "0")

And if both conditions are met, return 1.

You can also add additional conditions to your AND operator.

+1
source

Source: https://habr.com/ru/post/983378/


All Articles