# How To Use VLOOKUP With Multiple Criteria AND Multiple Lookup Columns In Excel

In this tutorial we will look at how we can use VLOOKUP with multiple criteria, but with the special twist that the choice of one criteria can come from different columns! Keep reading or watch the video and see how we use the functions of IF, ISNUMBER, VLOOKUP and SUMIFS to accomplish this feat!

This might be useful for you in a scenario where you want to pull sales data for a customer and state location by either their Customer Name or Customer Number. In our example, we will use student names or numbers for the selection.

So, here we have a list of Student #, Name, Class, & Grade, and notice from the drop down list in cell F4 that I can choose either the student’s name or number as one of the criteria for the VLOOKUP function to pull their correct grade:

Now, if we were to only use the student’s name and class to pull the correct grade, we could use the following formula in cell H7:

=VLOOKUP(SUMIFS(D2:D13,B2:B13,F4,C2:C13,G4),F9:G13,2,1)

Notice how I used the SUMIFS function to pull the grade number from column D. Now, we are not going to add anything up, but since there should only be one matching criteria of Name and Class, the correct value will result. Note also that we are using a “1” as the [range_lookup] in our VLOOKUP function because the match in the table in F9:G13 is an approximate match.

This formula will give us the right answer as long as a name is selected in cell F4, since it will look in cells B2:B13, the Name list, for a match. If we chose a number from the drop down list, we would get an #N/A error.

The same would occur if our formula in H7 was:

=VLOOKUP(SUMIFS(D2:D13,A2:A13,F4,C2:C13,G4),F9:G13,2,1)

…and we chose a name in cell F4:

So if we want to have the option to choose either the name or number, we can introduce an IF function that will test whether F4 is a number or not, using an ISNUMBER function as the logical test:

=IF(ISNUMBER(F4),value if true,value if false)

Now all we need to do is insert the VLOOKUP statement above looking for a number as the “value if true” condition, and the other VLOOKUP statement above looking for a name as the “value if false” argument, like this:

=IF(ISNUMBER(F4),VLOOKUP(SUMIFS(D2:D13,A2:A13,F4,C2:C13,G4),F9:G13,2,1),
VLOOKUP(SUMIFS(D2:D13,B2:B13,F4,C2:C13,G4),F9:G13,2,1))

And now, if we choose a number, it will use the first VLOOKUP formula, and if not, the second will be initiated:

What can you do next?
Subscribe to this blog for more great tips in the future!
Check out my YouTube channel – click on the YouTube icon below!

Happy Excelling!

### 3 Responses to How To Use VLOOKUP With Multiple Criteria AND Multiple Lookup Columns In Excel

1. Diego March 17, 2017 at 10:37 am #

Hi there, my name is Diego.

I’m trying to do something similar in Excel, however I need Vlookup to return a value depending on a couple selections in a list. I have some categories and I’m trying to work this out.
I’d appreciate you could give to me a hint.

Thank you very much.

• Michael Rempel March 17, 2017 at 1:27 pm #

Diego, I need more details on what you are trying to do. Can you explain more, or better yet, e-mail me at mrempel@excel-bytes.com with a sample file of what you are trying to accomplish.