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,

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.
- All about VLOOKUP and INDEX+MATCH formulas
- VLOOKUP multiple matches – trick
- INDEX formula and arrays
- Lookup last value
- The ultimate lookup trick – Multi-condition vlookup
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. 🙂
















One Response to “SQL vs. Power Query – The Ultimate Comparison”
Enjoyed your SQL / Power Query podcast (A LOT). I've used SQL a little longer than Chandoo. Power Query not so much.
Today I still use SQL & VBA for my "go to" applications. While I don't pull billions of rows, I do pull millions. I agree with Chandoo about Power Query (PQ) lack of performance. I've tried to benchmark PQ to SQL and I find that a well written SQL will work much faster. Like mentioned in the podcast, my similar conclusion is that SQL is doing the filtering on the server while PQ is pulling data into the local computer and then filtering the data. I've heard about PQ query folding but I still prefer SQL.
My typical excel application will use SQL to pull data from an Enterprise DB. I load data into Structured Tables and/or Excel Power Pivot (especially if there's lot of data).
I like to have a Control Worksheet to enter parameters, display error messages and have user buttons to execute VBA. I use VBA to build/edit parameters used in the SQL. Sometimes I use parameter-based SQL. Sometimes I create a custom SQL String in a hidden worksheet that I then pull into VBA code (these may build a string of comma separated values that's used with a SQL include). Another SQL trick I like to do is tag my data with a YY-MM, YY-QTR, or YY-Week field constructed form a Transaction Date.
In an application, I like to create a dashboard(s) that may contain hyperlinks that allow the end-user to drill into data. Sometimes the hyperlink will point to worksheet and sometimes to a supporting workbook. In some cases, I use a double click VBA Macro that will pull additional data and direct the user to a supplemental worksheet or pivot table.
In recent years I like Dynamic Formulas & Lambda Functions. I find this preferable to pivot tales and slicers. I like to use a Lambda in conjunction with a cube formula to pull data from a power pivot data model. I.E. a Lambda using a cube formula to aggregate Accounting Data by a general ledger account and financial period. Rather than present info in a power pivot table, you can use this combination to easily build financial reports in a format that's familiar to Accounting Professionals.
One thing that PQ does very well is consolidating data from separate files. In the old days this was always a pain.
I've found that using SQL can be very trying (even for someone with experience). It's largely an iterative process. Start simple then use Xlookup (old days Match/Index). Once you get the relationships correct you can then use SQL joins to construct a well behaved SQL statement.
Most professional enterprise systems offer a schema that's very valuable for constructing SQL statements. For any given enterprise system there's often a community of users that will share SQL. I.E. MS Great Plains was a great source (but I haven't used them in years).
Hope this long reply has value - keep up the good work.