Nesting IF

jamada

Active Member
Joined
Mar 23, 2006
Messages
323
Can someone be kind enough to assist me with this please, I dont know whats wrong with it?

=IF(A2=""+AND(IF(J3="","",IF(A2="FA",$X$3,IF(A2="999","",IF($J3="EMJ",Y3,IF($J3="A319",Y4,IF(J3="A320",Y5,IF(J3="A321",Y6,IF(J3="B767",Y7,IF(J3="B763",Y8,IF(J3="A330",Y9,IF(J3="777L",Y10,IF(J3="777W",Y11,""))))))))))))))
 

Excel Facts

How can you automate Excel?
Press Alt+F11 from Windows Excel to open the Visual Basic for Applications (VBA) editor.
I see several things wrong with it: too many nests, incorrect syntax, and I also have no idea what it is meant to do (too big for me to really take apart effectively).

Can you please explain exactly what this formula is meant to do?
 
Upvote 0
Thanks for the response, I dont think its the right way to go about what I'm trying to achive I just dont know any better!

Basically.

Q3 must be populated with data stored in range W3:Y11.

IF A2 = "FA", and J3 = Validated "EMJ", then Q3 must be populated with data stored in X3.
IF A2 = "SD", and J3 = Validated "EMJ", then Q3 must be populated with data stored in Y3.

IF A2 = "FA", and J3 = Validated "A319", then Q3 must be populated with data stored in X4.
IF A2 = "SD", and J3 = Validated "A319", then Q3 must be populated with data stored in Y4.

IF A2 = "FA", and J3 = Validated "A320", then Q3 must be populated with data stored in X5.
IF A2 = "SD", and J3 = Validated "A320", then Q3 must be populated with data stored in Y5.

Column W is where the validation list is.

This repeats itself throughth evalidation list until row/range Y12.

I hope this helps.... thank you
 
Upvote 0
Ok, this looks like it is something that we can better handle with an INDEX/MATCH formula.

Try this:

=INDEX($X$3:$Y$11,MATCH(J3,$W$3:$W$11,0),MATCH(A2,{"FA","SD"},0))
 
Upvote 0
Mr Kowz, your amazing!

I've been fighting with attempting this since yesterday morning, this is clean and simplified.

I did add $ to A2, A$2, and its fantastic.

I do have one question though, with the formulas extended down the appropriate range within column Q

Is there away Not to display #N/A in column Q, when Cell A$2 and any of the cells in column J have no data?

Thank You
 
Upvote 0
Try:

=IF(OR(A$2="",J3=""),"",INDEX($X$3:$Y$11,MATCH(J3,$W$3:$W$11,0),MATCH(A2,{"FA","SD"},0)))

Or alternatively if that doesn't work for you:

Excel 2003 or older:
=IF(ISERROR(INDEX($X$3:$Y$11,MATCH(J3,$W$3:$W$11,0),MATCH(A2,{"FA","SD"},0))),"",INDEX($X$3:$Y$11,MATCH(J3,$W$3:$W$11,0),MATCH(A2,{"FA","SD"},0)))

Excel 2007 or newer:
=IFERROR(INDEX($X$3:$Y$11,MATCH(J3,$W$3:$W$11,0),MATCH(A2,{"FA","SD"},0)),"")
 
Upvote 0
Its amazing what you can do with someone elses knowledge!

Thanks you very much for the assistance, time and effort on your part, it was/is appreciated!

Graham
 
Upvote 0
Its amazing what you can do with someone elses knowledge!

Thanks you very much for the assistance, time and effort on your part, it was/is appreciated!

Graham

Glad it works. Thank you for the feedback! ;)
 
Upvote 0

Forum statistics

Threads
1,224,550
Messages
6,179,461
Members
452,915
Latest member
hannnahheileen

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