How to Use INDEX MATCH

by Mark Wong on January 16, 2010 · 172 comments

in Excel

Any legitimate Excel user has used VLOOKUP and knows the syntax by heart.  (Lookup Value, Array, Column, etc.)  But many of these same users have never used INDEX MATCH before.  INDEX MATCH is one of several lookup formulas available in Excel.  It has certain features that make it superior to VLOOKUP in many situations.  Regardless of which method you think is better, (I have my opinion) it is definitely worth it to learn both formulas and have both at your disposal.

Click here for a detailed explanation of why INDEX MATCH is better than VLOOKUP

Please note that INDEX MATCH is designed for vertical lookups, which is the task that VLOOKUP performs.  If you need to perform a matrix lookup, consider using one of the more powerful Excel lookup formula combinations such as INDEX MATCH MATCH, OFFSET MATCH MATCH, VLOOKUP MATCH, or VLOOKUP HLOOKUP.

The VLOOKUP function

First our point of reference: the trusty VLOOKUP formula.  VLOOKUP returns a VALUE based on a defined array and column reference.  The syntax from Excel is as follows:

=VLOOKUP ( lookup value , lookup array , column , range lookup )

Below is an example of using VLOOKUP to return the value “Shirts” based on the lookup value “1089.”

Our goal was to lookup the Product of ID “1089″ and VLOOKUP did that without a hitch.  So how does INDEX MATCH replicate that functionality?

The INDEX function

The basic INDEX function returns a VALUE based on a defined array / column and a row number.  The syntax from Excel is as follows:

=INDEX ( array , row number )

Below is an example of using INDEX to return the value “Shirts,” assuming that you already know that the value is three cells down on your defined array.

(you also have the option to specify column number, but that isn’t relevant in a basic INDEX MATCH formula)

If you go 3 cells down in the INDEX array, you get the value “Shirts.”  But the problem we have when trying to do a lookup is that we typically don’t know what position our return value is located, which in this case is 3.  The “3″ needs to come from another formula.

The MATCH function

The basic MATCH function returns a NUMBER based on the relative position of a lookup value within a defined array / column.  The syntax from Excel is as follows:

=MATCH (  lookup value , lookup array , match type )

Below is an example of using the MATCH formula to return the position of “1089″ within our column reference.

Since “1089″ is three cells down in the array, the value “3″ is returned.

INDEX MATCH

When we combine both the INDEX formula and the MATCH formula, the number that the MATCH formula returns becomes the row number for your INDEX formula.

=INDEX ( array MATCH formula )

Below is an example of using the INDEX MATCH to return “Product Type” for our lookup value.

As you can see, it returns the same value we got from VLOOKUP.

Differences Between the Formulas

One of the key difference with INDEX MATCH is that, rather than selecting an entire array table, you are only selecting the lookup column and the return column of what would be a VLOOKUP array.  While not a big deal when it comes to simple lookups, this can definitely become a factor if you are dealing with large files that have thousands of lookups.  By limiting your arrays to only the lookup and return columns, you reduce the processing load on Excel.  The difference is illustrated below.

The other key difference is that INDEX MATCH formulas work as a right to left lookup, whereas VLOOKUP only works left to right.  As you can see in the example below, I can use INDEX MATCH to lookup a value that is to the right of my return value using INDEX MATCH.  This is not possible with the VLOOKUP formula, as you would have to rearrange your data set, or copy your lookup column so that it is always to the left of your return value.

I reversed our formula by looking up the ID of the “Shirts” Product Type.  I just changed our lookup value and swapped the lookup and return columns.

Remembering It All

A lot of Excel websites do a poor job of explaining how to use INDEX MATCH.  I’m not saying my way is any better, but here’s any easy way to remember how to use the formula, if you don’t want to mess with the detailed explanations and know how to use VLOOKUP.  Here’s how I think about the formula as I’m typing it in:

=INDEX ( Column I want a return value from , ( MATCH ( My Lookup Value , Column I want to Lookup against , Enter “0″ ))

{ 158 comments… read them below or add one }

silviafiniNo Gravatar June 1, 2014 at 9:27 am

Wow, thanks a lot! Finally I can use it!

And I’d also like to try helping answering question since we share knowledge:

Jenni: “Is it just me, or does index-match not play nice when you want to use auto-filters to sort and re-sort the data? Mine get all messed up, in a way that they didn’t when I’ve used vlookup.”

That happens because the reference moved when you sort the table.
You can simply block the whole column (A:A) instead of just few rows of the columns (A2:A18).

Rachel: “How do I use INDEX MATCH when multiple pages/tabs are involved? Is that possible?”

Yes that is possible. Just simply move to another excel sheet or workbook while you are typing the formula.

sunil Godbole: “I want to find out for last how many months customer have not given order (order value=0)”

You can use =COUNTIF([the whole row],0)

GODFREY: “is there way to have outputs of abbeverations that begin with B using index/match function in excel2007″

You can apply the formula explained above for that, as long as you have the list of the abbreviation code you want.

Ashley: “how can we get this to pull “NO MATCH” or something along those lines so we know the formula is running, there just isn’t a match..”

You can input the formula inside =IFERROR([your formula(index match or any)],”NOT MATCH”) or instead of NOT MATCH you can input anything that you want to replace the error value.

Bharat & Heather:
“but now I want to increment the output by 1 each time the input appeared.”

I’m not really sure what you expect, but if you want to increment you can simply add basic math in the formula. So your sample formula would be =INDEX($B$2:$B$69,MATCH(H26,$F$2:$F$69,0))+1

Naveen Kumar Singh: “Hello, Suppose i have a table, which is includes variable like:_name age sex salary, and each column include 10 values or more than that. So here, Question :- in want to see the largest two person salary including all detail in this way”

You can use =LARGE([salary column],2) for the second largest, and change the number 2 to 1 for the largest.

JRAJU: “if i have 4 columns of data, two columns combined entry, should look up values for the other two columns.
I want to know, which columns should be used for index, and which columns should we use match.”

It depends on what value you want to return. Column you use for index is always the column you want to return the value.

I hope it’d help. If you have any question you can email me to silviafini[at]gmail[dot]com
Maybe we can share knowledge about Excel, because I deal with Excel every minute of every day.

MKNo Gravatar June 12, 2014 at 9:48 pm

Superb.. One reading and I was sorted. Very nicely explained. This is the first time that I could properly understand index and match function

IrfanNo Gravatar June 16, 2014 at 5:20 pm

Good Explanation .

It will be highly appreciated , if you add more examples .

Joshua HamerNo Gravatar June 17, 2014 at 6:28 pm

Thanks so much for this tutorial, it’s incredibly helpful in the work that I do. However, I’ve run into an issue with it. I was able to get it to pull the data from one tab onto another properly, and I could use $ to lock the rows and columns to copy and paste it through the whole range. However, when I went to sort after doing this, the row references got completely out of sync and ruined the data table. Is there a way to lock the formula in place after a copy and paste to preserve the data without copying and pasting as values? Thanks!

Carl HermanNo Gravatar June 18, 2014 at 8:25 pm

Wow!

What a great explanation!

I’ve read definitions of Index Match before and always been frustrated. Thanks for explaining it in a way that makes sense to me! :)

AsifNo Gravatar June 21, 2014 at 4:30 am

Your way of explanation is effective , good work.

KvlarNo Gravatar June 22, 2014 at 11:47 pm

I have a table 20×24500 cells. All info for each product is along one row. I want to enter the product code on another sheet, then I want it to return the product description (column 6) AND where it was made (column 5) in 2 separate cells, giving me 3 cells of data from just entering the product code.

CallumNo Gravatar June 23, 2014 at 1:40 am

You can use index,match function left OR right. All you gotta do is chuck in the offset function

Leave a Comment

{ 14 trackbacks }

Previous post:

Next post: