Double if statements?

S

Shhhh

Hello all...

I currently have this formula, which works fine...

=IF(A20="L",L20-H20,H20-L20)

however now what I want to do is add an if statement to same cell that
says essentially...

If J20 is blank... return $0, otherwise do above formula.

Is this possible?


Thank you all,
This group is a life saver!!

Shhhh
 
F

FSt1

hi
nested if
=if(J20="",0,if(A20="L",L20-H20,H20-L20))

you can nest up to 7 ifs.
Regards
FSt1
 
A

AdamV

That nested IF will work for you, but it seems you may be doing some stuff a
;ong way round here.
Am I right in guessing that A20 has a formula which checks which of H20 and
L20 is smaller, so you can then do the minus the right way round?
If that is the case, you could do away with your IF altogether and just use
the ABS function, which basically throws away any minus sign, so you would
use ABS(L20-H20) and it will give you the difference between the higher and
lowerr of them.
So now you have something simpler like =IF(J20="",0,ABS(L20-H20))
 
Top