#1
|
|||
|
|||
IF + AND formula help
Hi,
I am trying to build a formula which allows the following conditions: the formula is on cell J2: -if H2<0 and H2+I2<0, return H2 -if H2<0 and I2 is N/A, return H2 -if H2>0 and I2<0, return 0 so far I have bould the following but it is not working: =IF(ISNA(I2),H2,IF(AND(H2>0,I2<0),0,IF(AND(H2<0),( H2+I2)<0),I2,(H2-I2))) Thank you very much in advance. Regards, |
#2
|
|||
|
|||
IF Condition THEN Result ELSE Alternative
You've given the Condition and the THEN Result but not the Else Alternative Quote:
|
#3
|
|||
|
|||
Quote:
IF I2=NA() THEN H2 ELSEIF H2>0 AND I2<0 THEN 0 ELSEIF H2<0 AND H2+I2<0 THEN I2 ELSE H2-I2 I'm not surprised it doesn't work. :-) |
#4
|
||||
|
||||
David, I agree with gebobs' diagnosis—that is, your IF formula does this:
Code:
If Then display I2 is N/A H2 H2>0 and I2<0 0 H2<0 and H2+I2<0 I2 else H2-I2 |
#5
|
|||
|
|||
you were missing an open parenthese after your second and, but beyond that they are right, your formula won't return what you want.
Try: =IF(AND(H2<0,(H2+I2)<0),H2,IF(AND(H2<0,ISNA(I2)),H 2,IF(AND(H2>0,I2<0),0,(H2-I2)))) |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Formula Help | withersd46260 | Excel | 2 | 04-30-2014 08:33 AM |
Formula Help - Look and if and that | Corca | Excel | 2 | 02-05-2012 09:18 AM |
help with formula? | doczilla | Excel | 2 | 09-25-2011 04:14 PM |
PMT Formula | OneOleGuy | Excel | 4 | 03-05-2011 09:54 AM |
If formula | sixhobbits | Excel | 1 | 10-02-2009 08:02 AM |