fbpx

VLOOKUP or INDEX+MATCH? – Excel Interview Question – 01


This is part of our Excel Interview Questions series. Subscribe for more questions.

VLOOKUP or INDEX+MATCH? When you should use each function and why?

This is such a great question to ask in interviews. So in my first installment of Excel interview questions, let me answer it.

Watch the answer – video

I made a video explaining both formulas and how to answer such interview question in detail. There is a quick demo of VLOOKUP, INDEX&MATCH and array use of INDEX too. Watch it below or on Chandoo.org YouTube Channel.

What is VLOOKUP?

VLOOKUP is Excel’s data search function. Given some data, you can use VLOOKUP to answer questions about it. Say you have data like this,

Excel vlookup example

You can use VLOOKUP to answer questions like,

  • How many customers did “Jonathan” have?
  • What is the net sales for “Jessy“?

Example VLOOKUP formulas:

To answer above questions, we can use below formulas:

  • VLOOKUP(“Jonathan”, Sales, 2, false)
  • VLOOKUP(“Jessy”, Sales, 3, false)

What is INDEX+MATCH?

INDEX+MATCH combination formula helps you answer same questions as VLOOKUP, but they also allow you to answer questions about data from anywhere (not just the left most column).

For example, you can answer questions like:

  • Who had net sales of 2,133?
  • Whose profit is 570?
  • What is net sales of “Jessy“?

Example INDEX+MATCH formulas:

To answer above questions, you can use below INDEX+MATCH formulas.

  • =INDEX(Sales[Sales Person], MATCH(2133, Sales[Net Sales], 0))
  • =INDEX(Sales[Sales Person], MATCH(570, Sales[Profit / Loss], 0))
  • =INDEX(Sales[Net Sales], MATCH(“Jessy”, Sales[Sales Person], 0))

When to use VLOOKUP?

VLOOKUP is a good option when you have simple data or lookup situations. Let’s say you just need to lookup details for someone or something out of a any sized data-set. Use VLOOKUP. It is easy to use and works as long as you are looking up on the left and returning values from right.

When to use INDEX+MATCH?

INDEX+MATCH combination is good for,

  • Looking up anywhere in data (not just in the left)
  • with large data-sets
  • when performing multiple lookups (usually thousands or more)

Why not just use INDEX+MATCH all the time?

This depends on your style. I prefer to use VLOOKUP for simple situations as it is easy to write. But whenever I am building a complex report or model with thousands of lookups, I try to use INDEX+MATCH formulas.

How to make lookups faster?

The best way to make lookups faster is by avoiding them. We can use relationships feature of Excel to connect tables and analyze without writing multiple lookup formulas.

But if you can’t use that, then rely on INDEX+MATCH structure as it allows better performance. To speed up lookups, follow below ideas:

  • Sort your data. If you can sort your data, that will make lookups very fast. You can omit the FALSE or 0 parameter in VLOOKUP / MATCH formulas with sorted data. Of course, the result will be wrong if what you are looking for is not there. But this can be solved by using an IF formula like this:
    • On sorted tables, =IF(MATCH(“Jessica”,Sales[Sales Person])<>”Jessica”, “Not found”, INDEX(Sales[Net Sales], MATCH(“Jessica”, Sales[Sales Person])))
  • Lookup once, get many times. For example, if you have multiple INDEX+MATCH formulas all doing same MATCH, then calculate the MATCH result once in a cell and refer to that in INDEX formulas.
  • Use array notation of INDEX. We can return arrays with INDEX formula. This tends to be faster than writing multiple INDEX formulas.
  • Use Dynamic Array functions (NEW). Excel 2019 is going to introduce powerful array functions like FILTER(), SORT() etc to dynamically generate array of results from your questions. If you have access to them, consider using them over normal array INDEX formulas.

Learn more about lookup formulas

If you want to learn all about VLOOKUP, INDEX+MATCH or other lookup techniques, check these links.

What is your answer?

Imagine you have this question in an interview. How would you answer it. Please share your response in comments.

Also, if you have any suggestions for Excel Interview Questions series, please post or email. 🙂

Chandoo

Hello Awesome...

My name is Chandoo. Thanks for dropping by. My mission is to make you awesome in Excel & your work. I live in Wellington, New Zealand. When I am not F9ing my formulas, I cycle, cook or play lego with my kids. Know more about me.

I hope you enjoyed this article. Visit Excel for Beginner or Advanced Excel pages to learn more or may be join my online video class to master Excel.

Thank you and see you around.

Related articles:

Written by Chandoo
Tags: , , , , , ,
Home: Chandoo.org Main Page
? Doubt: Ask an Excel Question

12 Responses to “VLOOKUP or INDEX+MATCH? – Excel Interview Question – 01”

  1. Gary Keramidas says:

    I use index + match when the lookup value is to the left of the criteria.

  2. XLarium says:

    Asking this question is like asking "Who is the best/strongest comic super hero character" in the comic book store.
    🙂

  3. Al says:

    Has anyone else noticed that vlookups and index/match seem to be working faster in recent months? I'm blindly attributing to this a program update of some sort. I regularly do vlookups & I/M on hundreds of thousands of rows and what used to take up to 45 minutes is now done in seconds. Some co-workers have noticed the same thing. Speed is no longer an issue.

  4. Anmol Puri says:

    Another option to speedup vlookup is to use double vlookup for larger datasets

    https://exceljet.net/formula/faster-vlookup-with-2-vlookups

  5. Venky says:

    For beginners it would be great to start with Lookups then jump to Indiex/Match

  6. Frank Welker says:

    How does vlookup/index+match compare to opening the table as a datasource and using sql queries?

    • Chandoo says:

      If your aim is to simply merge (join) both tables, then you are better off doing it outside Excel. SQL or Power Query are equally best places to do it. I would go with PQ as it gives me more options.

  7. Mark Knochel says:

    I use INDEX/MATCH almost exclusively, especially if I'm working with tables. I never worry about where my lookup column is, and if I use the column header descriptions for the second MATCH argument (of course, you can use a MATCH formula for the column argument in VLOOKUP), then my lookups are dynamic, i.e. the data array can be modified and the INDEX/MATCH doesn't lose it's way.

Leave a Reply


« »