If Statement inside If statement....

  • Thread starter Thread starter Shhhh
  • Start date Start date
S

Shhhh

Hello all,

I'd like to start by thanking all on this forum for the great advice
and assistance you provide! Saved me more times than I can count!

OK....

Here is the formula I currently have... =IF(J16="W",ABS(SUM(H16/I16)),-
I16)

This formula works great however in place of "ABS(SUM(H16/I16))" I
need to tell it to do that if the value in H16 is negative. If H16 is
positive I want it to perform "=I16*(H16/100)"

I'm not sure I explained what I want clearly so I'm going to put it in
words....

IF J16 is "W" then if the value in H16 is negative "ABS(SUM(H16/
I16))", however if it is positive "=I16*(H16/100)", If J16 is not W
then "-I16"

Thank you all for your awesome help. Looking forward to your answers!
 
Hello all,

I'd like to start by thanking all on this forum for the great advice
and assistance you provide! Saved me more times than I can count!

OK....

Here is the formula I currently have... =IF(J16="W",ABS(SUM(H16/I16)),-
I16)

This formula works great however in place of "ABS(SUM(H16/I16))" I
need to tell it to do that if the value in H16 is negative. If H16 is
positive I want it to perform "=I16*(H16/100)"

I'm not sure I explained what I want clearly so I'm going to put it in
words....

IF J16 is "W" then if the value in H16 is negative "ABS(SUM(H16/
I16))", however if it is positive "=I16*(H16/100)", If J16 is not W
then "-I16"

Thank you all for your awesome help. Looking forward to your answers!

Hi,

=IF(J16="W",IF(H16<0,ABS(H16/I16),I16*(H16/100)),-I16)

hth

Regards

David
 
Shhhh said:
IF J16 is "W" then if the value in H16 is negative
"ABS(SUM(H16/I16))", however if it is positive
"=I16*(H16/100)", If J16 is not W then "-I16"

=if(J16<>"W", -I16, if(H16>0, I16*H16/100, abs(H16/I16)))

Some notes:

1. You do not need to use the SUM function. There is no benefit in this
case.

2. Your algorithm does not behave well if J16="W" and I16=0. If that is a
possibility, I suggest:

=if(J16<>"W", -I16, if(H16>0, I16*H16/100, if(I16=0, 0, abs(H16/I16))))

This could be simplified by taking advantage of the coincidence that first
results works when I16=0:

=if(or(J16<>"W",I16=0), -I16, if(H16>0, I16*H16/100, abs(H16/I16)))


----- original message -----
 
Wow, an hour and a half trying to figure this mess out on my own... 20
mins on this group 2 excellent replies. You guys are awesome!
 
Back
Top