# Nested IF Statements not working

1. ## Nested IF Statements not working

=(IF(D2="Inner",(IF(C2="Antaro",(IF(OR(G2={"MC","MD","MDD"}),\$J2-\$I2-\$S\$9
=(IF(D2="Inner",(IF(C2="Merivobox",(IF(G2="ME",\$J2-\$I2-\$S\$10
=(IF(D2="Inner",(IF(C2="Legrabox",(IF(G1="C",\$J2-\$I2-\$S\$11
=(IF(D2="Inner",(IF(C2="Smooth",(IF(OR(G2={"MD","MDD"}),\$J2-\$I2-\$S\$12
=(IF(D2="Inner",(IF(C2="Dragon",\$J2-\$I2-\$S\$13

Hi, I have been trying to nest the above IF statements unsuccessfully. They (all 5), all work individually, but not when I try to nest them.
What has been happening is if the first statement is true it works and processes the formula. But if it is false, it ends there without going any further.
Is there a way to nest these? Or is there a better way to achieve what I am trying to do?

This was the best nested version.
=IFERROR(IF(D5="Inner",(IF(C5="Antaro",(IF(OR(G5={"MC","MD","MDD"}),\$J5-\$I5-\$S\$9,IF(C5="Merivobox",(IF(G5="ME",\$J5-\$I5-\$S\$10,IF(C5="Legrabox",(IF(G4="C",\$J5-\$I5-\$S\$11,IF(C5="Smooth",(IF(OR(G5={"MD","MDD"}),\$J5-\$I5-\$S\$12,IF(C5="Dragon",\$J5-\$I5-\$S\$13))))))))))))))),0)

Thanks.

2. ## Re: Nested IF Statements not working

Try:

``Please Login or Register  to view this content.``

3. ## Re: Nested IF Statements not working

Thanks AliGW, However it didn't work. There is a fault in the code.

=IF(AND(D2="Inner",C2="Antaro",OR(G2={"MC","MD","MDD"})),\$J2-\$I2-\$S\$9,
IF(AND(D2="Inner",C2="Merivobox",G2="ME"),\$J2-\$I2-\$S\$10,
IF(AND(D2="Inner",C2="Legrabox",G1="C"),\$J2-\$I2-\$S\$11,
IF(AND(D2="Inner",C2="Smooth",OR(G2={"MD","MDD"}),)\$J2-\$I2-\$S\$12,
IF(AND(D2="Inner",C2="Dragon"),\$J2-\$I2-\$S\$13,"")))))

Excel highlighted \$J\$2 in the second last line. Which in itself is not wrong. But I tried removing the Bracket in front of it which I thought looked out of place, and still no good.

4. ## Re: Nested IF Statements not working

AliGW, I just moved the comma one place to the right, looks like it may be ok now. Let me check it and come back to you.

5. ## Re: Nested IF Statements not working

It was a typo - your correction is correct.

Glad to have helped.

If that takes care of your original question, please choose Thread Tools from the menu link above and mark this thread as SOLVED. You can also access the SOLVED tag by editing the opening post and choosing SOLVED from the drop-down to the left of the title box.

Also, if you have not already done so, remember that you can reward anyone who offered you help towards a solution for your issue by clicking the small star icon (* Add Reputation) located in the lower left corner of the post in which the help was given. By doing so you can add to the reputation(s) of each of those who offered help.

#### Thread Information

##### Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1