13 Nested IF statements not returning "False" when relevant values should return "a"

AB1984

New Member
Joined
May 12, 2016
Messages
17
=IF($I15=1,
IF(OR(VLOOKUP(J$5,$A$5:$E$68,2,FALSE)=$J$4,VLOOKUP(J$5,$A$5:$E$68,3,0)=$J$4,VLOOKUP(J$5,$A$5:$E$68,4,FALSE)=$J$4),"a",""),
IF($I15=2,IF(AND(VLOOKUP(J$5,$A$5:$E$68,5,FALSE)="Y",(VLOOKUP(J$5,$A$5:$E$68,2,FALSE)=$J$4)),"a",
IF(OR(VLOOKUP(J$5,$A$5:$E$68,3,FALSE)=$J$4,VLOOKUP(J$5,$A$5:$E$68,4,FALSE)=$J$4),"a",
IF($I15=3,
IF(AND(VLOOKUP(J$5,$A$5:$E$68,5,FALSE)="Y",(VLOOKUP(J$5,$A$5:$E$68,2,FALSE)=$J$4)),"a",
IF(OR(AND(VLOOKUP(J$5,$A$5:$E$68,3,FALSE)=$J$4,VLOOKUP(J$5,$A$5:$E$68,4,FALSE)=""),VLOOKUP(J$5,$A$5:$E$68,4,FALSE)=$J$4),"a","")),
IF($I15=4,IF(VLOOKUP(J$5,$A$5:$E$68,2,FALSE)=$J$4,"a",""),
IF($I15="","",IF($I15=5,IF(AND(VLOOKUP(J$5,$A$5:$E$68,5,FALSE)="Y",(VLOOKUP(J$5,$A$5:$E$68,2,FALSE)=$J$4)),"a",
IF(VLOOKUP(J$5,$A$5:$E$68,3,FALSE)=$J$4,"a","")),"")))))),
IF($I15=5,
IF(OR(AND(VLOOKUP(J$5,$A$5:$E$68,3,FALSE)=$J$4,VLOOKUP(J$5,$A$5:$E$68,4,FALSE)=""),VLOOKUP(J$5,$A$5:$E$68,4,FALSE)=$J$4),"a",
IF(VLOOKUP(J$5, $A$5:$E$68,3,FALSE)=$J$4,"a","")))))

The above formula is returning the correct values when $I15 = 1,2 and 5. However when the value in $I15= 3 or 4 and all other conditions are met the returned value is "FALSE" rather than the expected "a". I have attempted to use the formula evaluation tool and didn't find it much use.
I have double checked the lookups and they're all looking in the correct place.

Any help would be greatly appreciated!
 

Excel Facts

When did Power Query debut in Excel?
Although it was an add-in in Excel 2010 & Excel 2013, Power Query became a part of Excel in 2016, in Data, Get & Transform Data.
Its very ugly but heres where the problem lies:

=IF($I15=1,IF(OR(VLOOKUP(J$5,$A$5:$E$68,2,FALSE)=$J$4,VLOOKUP(J$5,$A$5:$E$68,3,0)=$J$4,VLOOKUP(J$5,$A$5:$E$68,4,FALSE)=$J$4),"a",""),IF($I15=2,IF(AND(VLOOKUP(J$5,$A$5:$E$68,5,FALSE)="Y",(VLOOKUP(J$5,$A$5:$E$68,2,FALSE)=$J$4)),"a",IF(OR(VLOOKUP(J$5,$A$5:$E$68,3,FALSE)=$J$4,VLOOKUP(J$5,$A$5:$E$68,4,FALSE)=$J$4),"a",IF($I15=3, IF(AND(VLOOKUP(J$5,$A$5:$E$68,5,FALSE)="Y",(VLOOKUP(J$5,$A$5:$E$68,2,FALSE)=$J$4)),"a", IF(OR(AND(VLOOKUP(J$5,$A$5:$E$68,3,FALSE)=$J$4,VLOOKUP(J$5,$A$5:$E$68,4,FALSE)=""),VLOOKUP(J$5,$A$5:$E$68,4,FALSE)=$J$4),"a","")), IF($I15=4,IF(VLOOKUP(J$5,$A$5:$E$68,2,FALSE)=$J$4,"a",""),IF($I15="","",IF($I15=5,IF(AND(VLOOKUP(J$5,$A$5:$E$68,5,FALSE)="Y",(VLOOKUP(J$5,$A$5:$E$68,2,FALSE)=$J$4)),"a",IF(VLOOKUP(J$5,$A$5:$E$68,3,FALSE)=$J$4,"a","")),"")))))), IF($I15=5, IF(OR(AND(VLOOKUP(J$5,$A$5:$E$68,3,FALSE)=$J$4,VLOOKUP(J$5,$A$5:$E$68,4,FALSE)=""),VLOOKUP(J$5,$A$5:$E$68,4,FALSE)=$J$4),"a", IF(VLOOKUP(J$5, $A$5:$E$68,3,FALSE)=$J$4,"a","")),"ITS HERE!!!")))
 
Upvote 0

Forum statistics

Threads
1,215,650
Messages
6,126,019
Members
449,280
Latest member
Miahr

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top