Thursday, 24 November 2016

Why INDEX MATCH is Better Than VLOOKUP



When deciding between which vertical lookup formula to use, the majority of Excel experts agree that INDEX MATCH is a better formula than VLOOKUP.  However, many people still resort to using VLOOKUP because it’s a simpler formula.  One major driver of this problem is that most people still don’t fully understand the benefits of switching from VLOOKUP, and without such an understanding, they are unwilling to invest the time to learn the more complex formula.  The purpose of this post is to describe in detail all of the benefits of using INDEX MATCH and convince you that you should use INDEX MATCH exclusively for all of your vertical lookups.

If you don’t know how to use INDEX MATCH, please click here for a detailed tutorial.  Once you’ve learned INDEX MATCH and started using the formula consistently, you’ll reduce the number of spreadsheet errors you make, become more efficient in navigating Excel, and significantly improve your ability to create complex Excel models that have a heavy databasecomponent.

INDEX MATCH vs VLOOKUP 01

With the VLOOKUP syntax, you specify your entire table array, AND THEN you specify a column reference to indicate which column you want to pull data from.

INDEX MATCH vs VLOOKUP 02



It’s a small difference, but this additional step undoubtedly leads to more errors.  This error is especially prevalent when you have a large table array and need to visually count the number of columns you want to move over.  When you use INDEX MATCH, no such counting is required.
The next two advantages of using INDEX MATCH also come from the fact that VLOOKUP requires a static column reference input for the values you want to return.  Please note that you could get around the static reference issue by using a formula within the VLOOKUP syntax, creating a combination formula such as VLOOKUP MATCH or VLOOKUP HLOOKUP.  However, it’s much simpler just to learn INDEX MATCH and gain all the additional benefits beyond just having dynamic column reference.

Insert Column Immunity

The greatest benefit of using INDEX MATCH over VLOOKUP is the fact that, with INDEX MATCH, you can insert columns in your table array without distorting your lookup results.  Any time you work with a large dataset, there’s a good chance you’ll need to go back to edit our columns and potentially insert a new column.  With VLOOKUP, any inserted or deleted column that displaces your return values will change the results of your formulas.
Take the VLOOKUP example below.  Here, we’ve setup the formula to pull the State value from our data table.  Because it is a VLOOKUP formula, we have referenced the 4th column.
INDEX MATCH vs VLOOKUP 03

If we insert a column in the middle of the table array, the new result is now “Seattle”; we are no longer pulling the correct value for State and must change the column reference.
INDEX MATCH vs VLOOKUP 04
INDEX MATCH has insert column immunity, so you can insert and delete columns without worrying about updating every associated lookup formula.

Easier to Drag and Copy

When working with large datasets, it’s rare to write just a single lookup formula; you’re likely going to need to drag and copy your formula to multiple cells to perform multiple lookups.  For example, let’s say that for a specific ID, I want to return a series of values from my table in the exact same order as they appear in the table.  When I try to drag and copy the standard VLOOKUP formula across (with a reference lock on both the lookup value and the table array), the lookup doesn’t work because it just pulls the same value for each entry.  This deficiency is again caused by VLOOKUP requiring a specific column reference input for your return values.
INDEX MATCH vs VLOOKUP 05
With INDEX MATCH, because you can set the return column to float (essentially by not reference locking it) the return column will move as you copy your formula over, providing you the different fields as they appear.
INDEX MATCH vs VLOOKUP 06

No Array Restriction

Another key limitation of VLOOKUP is that it requires you to specify a square table array in which your column reference cannot move beyond.  The key situation when this becomes a problem is when you append a new field to your dataset beyond your original table array.  Consider the example below:
INDEX MATCH vs VLOOKUP 07
If I append a new column to this dataset, I can’t use my original VLOOKUP formula to pull values from that new column.  If I change my column reference to “6” the formula returns an error because my table is only 5 columns wide.  To make the formula work, I’d have to update the table array I specified every time I add a new column.
INDEX MATCH vs VLOOKUP 08
With INDEX MATCH, you don’t need to specify a table array and therefore don’t face this problem.

Right to Left Lookup

One of the key benefits of using INDEX MATCH is being able to create lookup keys on the right side of your data table.  New lookup keys are generally created by running calculations on fields within your original dataset.  These keys represent your lookup column within the INDEX MATCH syntax.  When using INDEX MATCH, you can append these new lookup keys to the right side of your table and perform a right-to-left lookup to pull the values you want to return.  The INDEX MATCH syntax doesn’t care whether your lookup column is on the left or right side of your return column.
INDEX MATCH vs VLOOKUP 09
With VLOOKUP, because you can only perform a left-to-right lookup, any new lookup key you add must be on the left side of your original table array.  Therefore, every time you add a new key, you have to shift your entire dataset to the right by one column.  Not only is this annoying, but it can also interfere with existing formulas and calculations you’ve created in your spreadsheet.

Doubles as an HLOOKUP

This probably isn’t the biggest deal to most users, but it’s still worth mentioning.  A VLOOKUP restricts you to only performing vertical lookups on a table array.  I can’t, for example, lookup values across the top of my dataset and perform a horizontal lookup.  To achieve this objective, I’d need to use a completely different formula.
With INDEX MATCH, you can simply arrange both your lookup array and return array horizontally to perform an HLOOKUP.  I don’t recommend doing horizontal lookups in general, but if you ever need to, you should definitely use the INDEX MATCH formula.

Lower Processing Need

The processing benefit of using INDEX MATCH has been marginalized in recent versions of Excel because the software’s processing capabilities have expanded so significantly.  But just give everyone a brief history lesson I’ll elaborate upon this benefit.  In some of Excel’s older versions, the software had tangible processing limitations that would be noticeable if you built a huge data set.  In some situations, I was required to lookup values for thousands of rows so I could append a new column to a large table.  Once I added all of these formulas, the software would freeze up and take several minutes to calculate the return values.  I eventually had to replace my VLOOKUP formulas with INDEX MATCH to speed up the calculations.
The reason for this difference is actually fairly simple.  VLOOKUP requires more processing power from Excel because it needs to evaluate the entire table array you’ve selected.  With INDEX MATCH, Excel only has to consider the lookup column and the return column.  With fewer absolute cells to consider, Excel can process this formula much faster.
Again, please keep in mind that this benefit is probably no longer noticeable given the improvements made in Excel’s processing power.  However, if for any reason you need to run thousands of lookup formulas within a spreadsheet, make sure to use INDEX MATCH.

Conclusion

The one disadvantage of using INDEX MATCH is that it is clearly harder to learn and more difficult to remember.  Excel does not have the syntax built into the software and the syntax by itself is not intuitive.  However, this hurdle can easily be resolved by reading a simple tutorial on how to use the formula.
Making the switch from VLOOKUP to INDEX MATCH was one of the key steps I took to improve the quality of the Excel models I built.  I now use INDEX MATCH exclusively for all of my vertical lookups.  I do this not just because it’s a better formula, but also because it helps me remember the more complex syntax.  Once you’ve made the switch, and experienced the benefits of using INDEX MATCH, I promise you that you won’t go back to VLOOKUP.