fbpx

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

Share

Share on facebook
Facebook
Share on twitter
Twitter
Share on linkedin
LinkedIn

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. 🙂

Share on facebook
Facebook
Share on twitter
Twitter
Share on linkedin
LinkedIn

Share this tip with your colleagues

Excel and Power BI tips - Chandoo.org Newsletter

Get FREE Excel + Power BI Tips

Simple, fun and useful emails, once per week.

Learn & be awesome.

Welcome to Chandoo.org

Thank you so much for visiting. My aim is to make you awesome in Excel & Power BI. I do this by sharing videos, tips, examples and downloads on this website. There are more than 1,000 pages with all things Excel, Power BI, Dashboards & VBA here. Go ahead and spend few minutes to be AWESOME.

Read my storyFREE Excel tips book

Chandoo is an awesome teacher
5/5

– Jason

Excel formula list - 100+ examples and howto guide for you

100 Excel Formulas List

From simple to complex, there is a formula for every occasion. Check out the list now.

20 Excel Templates

Calendars, invoices, trackers and much more. All free, fun and fantastic.

22 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.

  8. Rudy Salinas says:

    Since I am beginner here; I would prefer vlookup for now...

  9. Dana says:

    It depends on the report.

    If it's something that needs to be once, I'll use VLookup or Index+Match (VLookup for quick-and-dirty things, Index+Match for more complex things).

    If it's something that will need to be re-run on a regular basis, I'll use PowerQuery.

  10. Jim van Oss says:

    I always use Index+match as Vlookup/Hlookup are too quirky to deal with. Index+match always works the same way and are particularity useful with Tables.

  11. Dorothy A says:

    I am with Mark Knochel. I use Index match exclusively because it does everything VLookup does + more.

  12. Chari says:

    Index + Match always

  13. Michael says:

    I use vlookup mostly when I am working with simple and clean data, INDEX + Match when I am working with external connections that require complex and dynamic formulas

  14. David N says:

    Chandoo, in your closing bullets, for the one about sorting data, you forgot an INDEX in your example formula. Your MATCH for Jessica will never be Jessica, it will be the numerical position of Jessica. So you need to wrap it in an INDEX that also references the Sales[Sales Person] column.

    As for VLOOKUP versus INDEX-MATCH, I will join the chorus of those who use only the latter for all the advantages they (and you) have already noted and then some. I have not used VLOOKUP in at least a decade, and I will go to my grave encouraging others to throw it in the trash and never look back. I even tell people to consider it to be a cuss word that should be purged from our collective functional vocabulary.

    Knowing both ways is one thing, because there will always be that file you inherit from someone who used VLOOKUP. But actually using both is like saying you know how to write a book both by hand with a pen and by computer with your fingertips and then saying you prefer the ink pen because it's harder?!? Because it's a nostalgic trip down memory lane...maybe...but never because it's the better or easier choice. The pen will take longer (on average), and correcting mistakes will be a nightmare, while the computer is faster (on average) with corrections being a breeze. INDEX-MATCH can do literally everything VLOOKUP can even dream of and more, so let's move on and never cuss again.

  15. dheeraj says:

    hi chandoo sir
    my name is dheeraj nd i m from india,
    ofcourse i calk u sir i want to know about vlookup and average so i would like to know find average.
    regards

    Dheeraj

  16. Jesper says:

    Hey there,

    I have searched high and low for a way to compare 2 tables in the same excel file and populate a third containing unique names from both. Is this doable using power query or any other way?

  17. Andrey F says:

    Hi, Chandoo,

    Thanks for your tips. Much appreciated.

    So far I use I+M for case sensitive search together with EXACT. Vlookup doesn't see difference between C and c.

    BTW re speed. I've checked both Vlookup and I+M to search 421K rows main table vs 46K rows table. Both of my searched took the same time 2:15 min.

Leave a Reply