Help with nested if statements with vlookups

tiltz

New Member
Joined
Apr 3, 2012
Messages
22
I am trying to have a multiple criteria if statement to vlookup a value based region (which each is on a different tab). Each of the if statements work fine on their own, but not combined. What am i doing wrong here:

=OR(IF(A2="USA",VLOOKUP(B:B,USA!A:B,2,FALSE),"NA"),IF(A2="CAN",VLOOKUP(Canada!A:B,2,FALSE),"NA"),IF(Tracker!A2="EMEA",VLOOKUP(EMEA!A:B,2,FALSE),"NA"),IF(Tracker!A2="LATAM",VLOOKUP(LATAM!A:B,2,FALSE),"NA"),IF(Tracker!A2="Non-integrated",VLOOKUP(Non-Integrated!A:B,2,FALSE),"NA"))
 

Excel Facts

Can Excel fill bagel flavors?
You can teach Excel a new custom list. Type the list in cells, File, Options, Advanced, Edit Custom Lists, Import, OK
Hi,

You started your formula with the OR function, which will give you either TRUE or FALSE as a result.

Try Nesting your IFs, replace the "Value if False" part of the 1st IF statement (where it says "NA") with the Next IF statement, and so on:
 
Upvote 0
Just tried this still giving me an error:

=IF(A2="USA",VLOOKUP(B:B,USA!A:B,2,FALSE),IF(A2="CAN",VLOOKUP(Canada!A:B,2,FALSE),IF(Tracker!A2="EMEA",VLOOKUP(EMEA!A:B,2,FALSE),IF(Tracker!A2="LATAM",VLOOKUP(LATAM!A:B,2,FALSE),IF(Tracker!A2="Non-integrated",VLOOKUP(Non-Integrated!A:B,2,FALSE),"NA"))
 
Upvote 0
Your VLOOKUP functions don't contain a value to lookup? It's not 100% clear what you're trying to do; the OR() at the start can't be right. So it's something like this:

If Tracker!A2 = "USA" then lookup {some value} in column A of sheet USA and return the value from column B. If the value doesn't exist then return "NA"
Similar conditions for CAN, EMEA, LATAM and Non-integrated

The question is, what is {some value} - is it in cell B2? Also, what happens if A2 is not one of these values? Pure guesswork here but what about:

Code:
=IFERROR(VLOOKUP(Tracker!$B2,INDIRECT(Tracker!$A2&"!$A:$B"),2,FALSE),"NA")

WBD
 
Last edited:
Upvote 0
Just tried this still giving me an error:

=IF(A2="USA",VLOOKUP(B:B,USA!A:B,2,FALSE),IF(A2="CAN",VLOOKUP(Canada!A:B,2,FALSE),IF(Tracker!A2="EMEA",VLOOKUP(EMEA!A:B,2,FALSE),IF(Tracker!A2="LATAM",VLOOKUP(LATAM!A:B,2,FALSE),IF(Tracker!A2="Non-integrated",VLOOKUP(Non-Integrated!A:B,2,FALSE),"NA"))

You're missing a few closing brackets ) for the IFs, it should look something like below, I can't test the formula as I don't want to create all those Sheets and dummy data, see if it works:


Excel 2010
C
1#REF!
Sheet30
Cell Formulas
RangeFormula
C1=IF(A2="USA",VLOOKUP(B:B,USA!A:B,2,FALSE),IF(A2="CAN",VLOOKUP(Canada!A:B,2,FALSE),IF(Tracker!A2="EMEA",VLOOKUP(EMEA!A:B,2,FALSE),IF(Tracker!A2="LATAM",VLOOKUP(LATAM!A:B,2,FALSE),IF(Tracker!A2="Non-integrated",VLOOKUP(Non-Integrated!A:B,2,FALSE),"NA")))))
 
Upvote 0
The formula is no longer erroring, but it's only pulling in the info from the USA tab:

[TABLE="width: 398"]
<colgroup><col span="2"><col></colgroup><tbody>[TR]
[TD]USA[/TD]
[TD]DENVER[/TD]
[TD="align: right"]5/18/2018[/TD]
[/TR]
[TR]
[TD]USA[/TD]
[TD]CRANSTON[/TD]
[TD]Week of 5/7[/TD]
[/TR]
[TR]
[TD]USA[/TD]
[TD]ATLANTA[/TD]
[TD]TBD[/TD]
[/TR]
[TR]
[TD]USA[/TD]
[TD]TAMPA[/TD]
[TD]TBD[/TD]
[/TR]
[TR]
[TD]CAN[/TD]
[TD]Richmond, BC[/TD]
[TD="align: center"]#VALUE![/TD]
[/TR]
[TR]
[TD]CAN[/TD]
[TD]Toronto ICD[/TD]
[TD="align: center"]#VALUE![/TD]
[/TR]
[TR]
[TD]CAN[/TD]
[TD]Montreal ICD[/TD]
[TD="align: center"]#VALUE![/TD]
[/TR]
[TR]
[TD]EMEA[/TD]
[TD]Cadishead, UK[/TD]
[TD="align: center"]#VALUE![/TD]
[/TR]
[TR]
[TD]EMEA[/TD]
[TD]Widnes, UK[/TD]
[TD="align: center"]#VALUE![/TD]
[/TR]
[TR]
[TD]EMEA[/TD]
[TD]Belgium[/TD]
[TD="align: center"]#VALUE![/TD]
[/TR]
[TR]
[TD]EMEA[/TD]
[TD]Genay, France[/TD]
[TD="align: center"]#VALUE![/TD]
[/TR]
[TR]
[TD]EMEA[/TD]
[TD]Morolo, IT[/TD]
[TD="align: center"]#VALUE![/TD]
[/TR]
[TR]
[TD]LATAM[/TD]
[TD]Guadalajara [/TD]
[TD="align: center"]#VALUE![/TD]
[/TR]
[TR]
[TD]LATAM[/TD]
[TD]Recife[/TD]
[TD="align: center"]#VALUE![/TD]
[/TR]
</tbody>[/TABLE]
 
Upvote 0
Did you try my formula?

Code:
=IFERROR(VLOOKUP(Tracker!$B2,INDIRECT(Tracker!$A2&"!$A:$B"),2,FALSE),"NA")

WBD
 
Upvote 0
My post #5 was ONLY to correct your brackets, it's Not meant to be a working formula as I stated.

I didn't even really look thru the formula, but as WBD pointed out, you're missing the LOOKUP values in your formula, so correct them as suggested by WBD.
 
Upvote 0
Ah. Shame they don't match. Try this then:

Code:
=IFERROR(VLOOKUP($B2,CHOOSE(MATCH($A2,{"USA","CAN","EMEA","LATAM","Non-integrated"},0),USA!$A:$B,CAN!$A:$B,EMEA!$A:$B,LATAM!$A:$B,'Non-Integrated'!$A:$B),2,FALSE),"NA")

WBD
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,177
Members
453,021
Latest member
Justyna P

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