The Basics of INDEX & MATCH
Excel experts generally substitute VLOOKUP with INDEX and MATCH.
Unlike VLOOKUP, which searches only to the right, INDEX and MATCH can look in both directions – left and right.
INDEX & MATCH can perform two-way lookups by both looking along the rows and along the columns to find the intersection within a matrix.
INDEX & MATCH is less prone to errors.
Assume you have a VLOOKUP where the final value you want returned is in column N.
Your lookup value is in column A.
You need to highlight the entire A to N range and then provide your index number as 14.
If you happen to delete any of the in-between columns, you would have to update that index number.
You don’t need to worry about this when you use INDEX & MATCH.
All in all, INDEX and MATCH is more flexible than VLOOKUP.
What it is
INDEX and MATCH are “nested” functions – two functions used together.
The first argument of INDEX is to give it an array. This array (range) should include your answer. You then need to specify how many rows to go down and how many columns to move to find the correct value. You cannot move outside the INDEX range.
The syntax of INDEX is:
- The range where the return value resides.
- Number of rows to move down (the row index)
- Number of columns to move to the right (the column Index). This argument is optional. If you only have one column, you can leave the column argument empty, otherwise, you need to specify the number of columns to move over, in the range.
Here is an example of INDEX without MATCH:
As shown above, INDEX alone is not useful for identifying the number of rows or columns to move. This is where MATCH comes into play. It helps the INDEX function to locate the answer.
The MATCH function was designed to return the position or address of the lookup value to the INDEX function. This is what differentiates MATCH with other functions. It does not return the VALUE in the cell but returns the POSITION of the cell within a specified range.
The MATCH function’s syntax is as follows:
- Like VLOOKUP, Match needs a lookup (target) value. The user can reference a cell or directly type the value into the formula.
- Lookup_array: The “list” (range) where the return values are located.
- Match_type: 0 for an “exact”
In the below example, the MATCH function returns the value of 4. 200 is 4 rows down from the specified range.
The important point to note on the MATCH function is that it’s a one-way street – you can only have one row or one column selected.
Tip: If your MATCH contains multiple criteria then you need to turn the multiple criteria into a one-way street. You can do this by wrapping the MATCH function inside another INDEX or by converting your formula to an array – CSE – function. To watch this in action, refer to the INDEX & MATCH Lecture in my Advanced Excel Training XelPlus.com/AdvancedExcelCourse
Putting it together
When INDEX and MATCH are used together, the MATCH function finds the look up value’s row / column index and then hands this value off to the INDEX function to get the lookup value. The example below shows how these work in tandem.
This formula can be further manipulated to find the entity with the highest sales. To do this, simply nest the MAX() function inside the MATCHfunction to find the location of the highest number.
The VLOOKUP function has to include all the columns in your range even if in-between columns aren’t needed. INDEX and MATCH only requires the return value column which can significantly reduce processing time in larger worksheets.
The easy way to remember the syntax of the INDEX and MATCH is
=INDEX (The range location of my answer, MATCH(The value I’m looking for, The look-up range to find the Value, 0))
Use INDEX MATCH & a second MATCH in cases where you need to look up a value in a matrix. MATCH is used twice: once for the rows and once for the columns. In this example, the return range in the Index function involves multiple columns and the MATCH function instructs the formula to move down a certain number of rows and move over a number of columns across the sheet to retrieve the desired value.
Instead of just selecting a single row or column you need to index the entire table with multiple rows and columns as your array since your value is somewhere inside this matrix.
The syntax of the INDEX MATCH MATCH function is:
=INDEX(The full range where your answer can be found in, MATCH(The value I’m looking for in the rows, The range I need to find the Value, 0), MATCH(The value I’m looking for in the columns, The range I need to find the Value, 0))
Building on the INDEX and MATCH Function
By nesting INDEX and MATCH in other formulas you can create more complex, dynamic calculations. The example below, shows how you can nest INDEX and MATCH in the SUMIFS function. This way you can show the SUM of either the sales column or the volume column depending on whether you select “Volume” or “Sales” in G4. The summing value criteria it uses are West_01 in column A, 2014 in B and Jan in C. Once you change the value in G4 from “Volume” to “Sales”, the results are changed to SUM the values from the sales column. This can be used in dynamic dashboard reports.
Video and Workbook
INDEX & MATCH is one of my favourite functions because it can be used in many complex situations. A complete understanding of this function is what separates the gurus from the merely capable.
Feel free to Download the Workbook HERE.
Check out Part 2 of this guide, where we go into more advanced uses of INDEX & MATCH.
Try it yourself
I hope you liked Part 1 of my guide to INDEX & MATCH. What did you think of it?
Do you have any questions?
In any case, give me an idea of how this worked out by leaving a comment below.
The new Excel Dashboards course is here!
Now available on Udemy
Visually Effective Excel Dashboards for your reports.
Redeem your coupon for 75% off below.