*If you have a high priority Excel problem, hire an excel expert from GetXperts.com to help you immediately*

If you’re using Excel and you’ve already learned how to use INDEX MATCH, you’re well on your way to becoming proficient with Excel lookups. What INDEX MATCH MATCH offers you is a more powerful version of the formula. Instead of just a vertical lookup, INDEX MATCH MATCH allows you to perform a matrix lookup, which is also known as a two-way lookup. This combination formula may initially seem complex because of its three individual formulas, but after you understand each component and how they interact, using this tool will become second nature to you. INDEX MATCH MATCH is one of several lookup formulas you should learn to become adept in database theory.

**Objective and When to Use**

There’s really just one key condition that needs to be met before you can use INDEX MATCH MATCH:

**A matrix lookup can only work if your data table has lookup values on both the top and left hand side.**

Basically, your data needs to be in a matrix format. People usually create matrixes, with lookup values both vertically and horizontally, to cross reference two different fields. In the example below, we are cross referencing the field **State** with the field **Year** and showing the relevant data point for **Sales**.

Creating a matrix saves you space within your spreadsheet and is more visually appealing. However, most data sets are not organized in this fashion. In fact, if you follow proper database theory, your data actually should not have lookup values going both vertically and across your table. A properly formatted table would look like the example below:

Before moving forward, ensure that you are using the proper formula for your data set. There are several other lookup options you can choose from if your data does not fit the requirements for INDEX MATCH MATCH. For example, if you only have lookup values on the top of your data set, you should consider using HLOOKUP. If you only have lookup values on the very left hand column of your data set, you should consider using VLOOKUP or INDEX MATCH.

**The Syntax**

Below is the syntax for using this formula combination. Don’t worry if it doesn’t make sense now; the rest of this post will provide context for each component and we’ll review a more practical version of the syntax that’s easier to remember.

= INDEX ( **array** , MATCH ( **lookup_value** , **lookup_array** , 0 ) , MATCH ( **lookup_value** , **lookup_array** , 0 ) )

Not surprisingly, INDEX MATCH MATCH is based on the INDEX and MATCH formulas, which we will now go through in detail.

**The INDEX Formula**

The INDEX formula asks you to **specify a** **reference** within a range and **returns a value**. In its simplest form, you just indicate either a row or column as your range, specify a reference point, and the value that matches that reference point is returned. For example, if we were to select the left hand column of this table, and specify the reference “6”, the INDEX formula would return the value “WA”.

Now instead of using just selecting a single row or column, what you can also do with the INDEX formula is select an entire matrix, with multiple rows and columns, as your array. The key difference here is that, instead of just specifying a single appearance order as a reference, you must now provide both a vertical and horizontal reference to return your value. (Please note that the INDEX formula always takes the vertical reference first) Using the INDEX formula with a matrix reference represents the foundation of utilizing INDEX MATCH MATCH. The syntax for the INDEX formula by itself is as follows:

= INDEX ( **array** , **row_number** , **column_number** )

For example, let’s say we selected the entire sales data table, and then specified “6” as the row number and “4” as the column number. The INDEX formula performs the intuitive action of going down 6 rows and over 4 columns with the range we selected to return the value of “$261.04”.

**The MATCH Formula**

The MATCH formula asks you to **specify a value** within a range and **returns a reference**. The MATCH formula is basically the reverse of the INDEX formula. The two formulas have the exact same components, but the inputs and outputs are rearranged.

= MATCH ( **lookup_value** , **lookup_array** , 0 )

To give you an example of the MATCH formula, if we were to select the entire left hand column and then specify “WA” as our lookup value, the MATCH formula would return the number “6”. Please note that you have to put in a “0” as the last argument to ensure that the MATCH formula looks for an exact match.

**How it Works**

As mentioned before, when using the INDEX formula across a matrix it requires both a horizontal and vertical reference. The only additional complexity that INDEX MATCH MATCH adds is that the vertical and horizontal references are turned into MATCH formulas.

**Putting it Together**

Below is a simplified version of the syntax describing the inputs with the appropriate context for our goal. In case you get lost in the individual steps, you can always refer back to this notation.

= INDEX ( **entire matrix** , MATCH ( **vertical lookup value,** **entire left hand lookup column** , 0 ) , MATCH ( **horizontal lookup value** , **entire top header row** , 0 ) )

**Step 1**: Start writing your INDEX formula and select the entire table as your array

**Step 2**: When you get to the row number entry, input the MATCH formula and select your vertical lookup value for the lookup value input

**Step 3**: For the lookup array, select the entire left hand lookup column; please note that the height of this column selection should be exactly the same height as the array for the INDEX formula

**Step 4**: For the final argument in the MATCH formula, input 0 to perform an exact match and close out the MATCH formula

**Step 5**: Now that we’ve arrived at the column number entry of the INDEX formula, input another MATCH formula but this time select your horizontal lookup value for the lookup value input

**Step 6**: For this lookup array, select the entire top header row of the original grid you selected for the INDEX formula

**Step 7**: Repeating what we did for the previous MATCH formula, input “0” for an exact match and close both the MATCH formula and the INDEX formula with parentheses

**What Excel Does**

Excel must first calculate the result of the two MATCH formulas embedded within the INDEX formula. Since we know that “WA” is the sixth value down in the left hand column, and “2004” is the fourth value across in the top header row, those formulas become the values of 6 and 4 respectively. Once we’ve simplified those components, Excel essentially performs the exact same INDEX lookup that we demonstrated before; it goes down 6 rows and over 4 columns to pull the correct value of “$261.04”.

**Summary**

INDEX MATCH MATCH probably won’t be a formula you use often. Most of the time when dealing with databases and data tables, you’ll be using vertical lookups to query results. However, in situations where you absolutely do need to perform a matrix lookup, INDEX MATCH MATCH is the best option you have.

{ 57 comments… read them below or add one }

Thanks for sharing the “INDEX MATCH MATCH” formula. Even this formula has not been used more often because it is a bit complex and contain several syntax.

Anyhow, this is very good tutorial that describe step by step clearly for following.

It’s good job!. I do love it.

Michael Leng

Thanks for the great article! I have one important question though….

Can I create an Index Match Match where the values being looked up are in one Excel file and the returned values are being stored in a different Excel file? If so, how do I specify that? If I can’t use two different Excel files (workbooks), can I at least use two different worksheets in the same file and, if so, how do I specify that?

Just to clarify, my situation is that I have a master file that lists a bunch of people who are supposed to take a certain e-course. I can run a report (which can be downloaded as an Excel file) on the LMS that shows everyone who’s accessed the e-course and what their completion status is. I want to be able to add course-completion info to each person in my master list. (The problem with the report from the LMS is that it doesn’t show anyone who hasn’t accessed the course, so I need a way to be able to also see people who should have, but haven’t, accessed the course yet.)

Thanks, in advance, for any help with this that you can give me!

Laura

Hi Laura,

Yes, you can write formulas across different workbooks, by literally just selecting the cells from those different workbooks. However, this is generally not recommended, because if anything changes with you store your files, the formula will be broken.

Likewise, it’s definitely possible to write this formula within the same workbook across different worksheets. Simply click on the cells you want from the other worksheet, as you are writing the formula. I definitely recommend the latter approach if possible, as it is much more common and generally more stable.

Best,

Matthew

Hi Laura,

Yes, you can write formulas across different workbooks, by literally just selecting the cells from those different workbooks. However, this is generally not recommended, because if anything changes with you store your files, the formula will be broken.

Likewise, it’s definitely possible to write this formula within the same workbook across different worksheets. Simply click on the cells you want from the other worksheet, as you are writing the formula. I definitely recommend the latter approach if possible, as it is much more common and generally more stable.

Best,

Matthew

Matthew,

nice tutorial, thank you for this. It works for me properly only if I have data sorted in alphabetical order in the first column. What I am doing wrong?

Paul

This is awesome, will save me tons of time. Very clear explenation except i belive there is a small error in your simplified syntax version:

= INDEX ( entire matrix , MATCH ( entire left hand lookup column , vertical lookup value , 0 ) , MATCH ( entire top header row , horizontal lookup value , 0 ) )

the lookup value and lookup column are backwards.

i belive it should be

= INDEX ( entire matrix , MATCH ( vertical lookup value , entire left hand lookup column , 0 ) , MATCH (horizontal lookup value , entire top header row , 0 ) )

Thanks for the catch. I must have flipped those when I was creating the example. The syntax has been updated.

Does anyone know how to do this BACKWARDS???

As in, can I look up a value and it will tell me the corresponding row and column??

What you are trying to do would use the INDEX function.

Hi Matthew, Thank you for the good explanation with the INDEX MATCH MATCH, however can it be also be done using two area? INDEX(MATCH,MATCH, area number)?

Hello,

thanks for the formulas. However I have been trying to use this formula but need do the match with two horizontal values but does not seem to work, do you have any idea?

Can you have 3 different criteria? Ie – I want to match 1 vertical and 2 horizontal criteria, I tried using index match match match but that didn’t work as I got a reference error.

Thanks.

I was also looking for how to do this backwards (same as Feedback, 20 Jan, 2014). So given 261.04, find the year and the state (in the example given). For example, can you find the biggest sales number (which is just MAX(C12:F19)), and then look up which state and year that was.

One obvious way to do it involves adding another row (or column). So you add another row which has a formula something like this:

=IFERROR(VLOOKUP(lookupvalue,C$12:C$19,1,FALSE),FALSE)

Suppose you put that in C21 and drag it out to the right to F21. That row will have a bunch of FALSEs (meaning that the value doesn’t appear in the corresponding column), and the actual value you’re looking up (lookupvalue).

Then you do a MATCH on that row, to figure out the right column (note that if it appears more than once, you’ll only get the first row containing it, but that’s the way with badly defined reverse lookups!)

=MATCH(lookupvalue,C21:F21,0).

This will give you the column that the value appears in (suppose this is in E3).

=MATCH(lookupvalue,OFFSET($B$12:$B$19,0,$E$3),0)

This will give you the row that the value appears in.

You can use this to get the state and year or whatever you want.

Will this work if I have, for example, multiple rows with WA data?

That’s great! Thank you!

Matthew – I had an array that I have been wrestling with for 4 weeks – and not until I found your concise, easy to follow instructions was I able to complete my task.

You are a life saver. THANKS!

Matthew,

Can you show me how to retrieve match data using index match or if index match across different worksheets?

Example:

Worksheet 1 (contains team numbers. this is where i want to receive data from sheet 2 if the team numbers match)

A1:A3 contains team numbers (A1=1, A2=2, A3=3)

Worksheet 2 (contains teams scores)

A1:A3 contains team numbers (A1=1, A2=2, A3=3)

B1:B3 contains the teams scores (B1=10, B2=21, B3=12)

I want to pull the teams scores from worksheet 2 and place the data into column B in worksheet 1. I keep getting a “0”. Please help

Hi,

i have a small problem. i made a matrix for some types of chairs and the different colors that they are available in. the matrx looks somehow like this:

Blue Green Yellow

chair 1 x x

chair 2 x

chair 3 x x x

i would like to be able to execute a lookup for a certain type of chair and as a result get the available colors.

anybody that can help me out?

Regards,

hendrik Evens.

I am trying to write a formula that will confirm cell C3 matches with somthing from Column R and if so return “Yes”, if not I want it to look in Column S and if it matches than return “second”, if not I want it to look in column T and if it matches than return “third”, otherwise return “not identtified”.

Is anyone able to assist me? I know there has to be nested formulas in this combination but I am not sure which ones would work most efficiently.

Hope this will work for you.

=IF(VLOOKUP(C3,R2:R4,1,1)=C3,”Yes”,IF(VLOOKUP(C3,S2:S4,1,1)=C3,”Second”,IF(VLOOKUP(C3,T2:T4,1,0)=C3,”Third”,”Not Identified”)))

very useful approach – index Match Match and Matrix lookup, for us in developing world, it is very helpful.

Regards

Wilberto Msigwa

i’m not sure how will i apply this INDEX MATCH MATCH in my table to get the following:

i want to get the latest value of coloum A. coloum B is like the stage PP is the 1st stage DD is Next stage and so forth… the same with coloum C (30, 60, 90). in coloum E i want to have a mark “KKK” if it’s the latest value considering coloum B,C and D:

A B C D E

xx PP 60 5/6/2014

xx PP 90 6/24/2014

yy DD 60 3/24/2014

yy DD 90 6/10/2014 KKK

xx DD 30 7/15/2014 KKK

how to make formula that if there are 30 days in a month & if he is Present 27 days add 3 so that he gets full paid but if he is 29 days prsnt how to make formula for full paid

Hello,

This is awesome. thanks. I have a task that is a little more complicated. Lets see if someonr knows how to solve this.

I am matching two different sets of data that may have some common matching numbers.

In the illustration above, we are applying the index match match to match two individual values to those in a matrix and get the desired result.

I need to apply this to two different data sets and display the common values in a third data set.

Am I clear ? should I rephrase?

Lets hope you know how to do this.

Thanks.

Anan

I am currently using the Index Match Match formula across several worksheets. However, the issue that I am having with my formula occurs when one of the worksheets that my Index Match Match formula uses to search through does not contain a match for the master sheet. When this occurs, I receive the #N/A. The formula works excellent if every worksheet has an entry that corresponds to the Master worksheet however not every worksheet will have a match to the master. Any suggestions?

Use the If(usurer formula… then it will leave it blank

Is there any way to choose the 2nd or 3rd matching column value for the column reference? For example, if my column titles are Q1, Q2, Q3, Q4, Q1 is there any way to ensure that I pull the 2nd Q1 value?

Thanks,

JJ

hello,

I have tried this formula =INDEX(Forecast!A4:O58,MATCH(A5,Forecast!A5:A58,0),MATCH(setup!$B$11,Forecast!$A$4:$O$4,0))

but the result is showing 0. even there is some value in the cell

Please help on this regard

Hey! thanks for the tutorial..i was wondering, how to do the exact opposite of what you did? what i mean is, how to construct a table which has state and year on y and x axis respectively, from a table in which both are in the same dimension. Basically constructing table a from table b..reverse of your example

Hi

This is a very good article and thorough example! Thank you for posting!

Just wondering, I have a data table with all the payroll information in columns and with account codes, however, some payroll categories are using the same account codes. and therefore I require a sum functionality. The added issue is that each person can be paid in different currencies and have different departments. I have to sum up all the cost centres and the currencies (which are in rows) and with the same account codes (In column) The way round it I have found is sumproduct where I can perform a multiple lookup for the columns and sum up all the tables with the given account codes.

I want to know if there is another way to do this calculation as sumproduct takes a long time to calculate and I am investigating if Index and Match formulas can give me a faster calculation.

Thanks

Vivian

Hi Team,

Please help on the below.

R O U T E ABC XYZ MNZ RXZ LOWEST

Bangalore 100.00 200.00 300.00 150.00 100.00

ABC Quoted lowest price in the above table

Tranporter name need to be refelct in Next coloum

can you write formula

Thank for the tutorial. Much appreciated.

However, I have a question following on from this. Is it possible to use the same formula to display an exact value using two vertical conditions at either ends of a matrix and the horizontal condition in the matrix ?

i.e.

Using your matrix in this tutorial [assume column 5 was replaced by a name of county from that state]. Is it possible to match a state (vertical column) to its corresponding county (Vertical column) before returning the exact value (the result) in a particular year (Horizontal column)?

Kind regards

Thank you for writing this article – was exactly the solution I needed!

I have a need to sum the values for a specific row. In the case of this articles data, the problem would look like this:

Return the sum sales for a specified state for years 2002-2003.

I need the range of years to be dynamic and consecutive, meaning a user can fill in a start and end year (ie, ’02-’03, ’02-’05, etc.).

Can you please assist? Much appreciated!

Please assist with this scenario:

let’s say in your example you have an additional column called Region:

Region State 2004 2005 2006 2007

WC NY XXX XXX XXX XXX

WC FL XXX XXX XXX XXX

EC OR

EC CA

WR AR

WR TA

In this case how do we pull the same information??

Don’t worry I have figured it out!

=+INDEX(Act_Volumes!$D$3:$O$240,MATCH($B2&$C2,Act_Volumes!$C$3:$C$240&Act_Volumes!$B$3:$B$240,0),MATCH($A2,Act_Volumes!$D$2:$O$2,0))

I have been using Index match match in my deliverables workbook to consolidate data from my master file workbook. I have these in 2 different workbooks due to their massive size. My index match match on my deliverables file only returns data when the master data file is open otherwise I get a #VALUE! error. Is there a way to write the formula so I don’t have to have the master data file open in order to look at the delieverables file?

Many Thanks

I need help with INDEX MATCH. I undestand that index match will return a value higher than, lower than, or equal to your lookup value based upon entering a ‘1’, ‘-1’ or ‘0’ at the end of your formula. But I need it to return the value that is NEAREST to my lookup value.

Please help!!!!!

Thank you so much

Hi, and what if I have to sum all of the results of the index/match, and not just return the first value matching?

This is the formula I’m using now:

=INDEX(Hires!$A:$BA; MATCH($A15;Hires!$B:$B;0)+4; MATCH(HR!AG$2;Hires!$1:$1;0))

Thanks in advance.

Great!

I use Vlookup more often than I should…

For complex models it turns very slow.

The performance with INDEX MATCH MATH is awsome.

Thanks!

working brilliantly thank you

This example was very helpful. My one question is if the matching criteria are not exact values how would the formula change?

What if the criteria you are looking for is a range of numbers. From example one of the y axis columns is 0-100,000 and the next column is 100,000-200,000

Great post! I almost didn’t leave a comment, but you made my job that much easier. I love how dynamic this allows excel to be. Thanks again

what if the criteria you are looking for is a range of numbers? how would this change the function?

Hi my friend,

Index Match Match is really a powerful tool. i believe in this simple tutorial a simple vlookup Match would do the trick, with less syntax.

=VLOOKUP(State , Array , Match(Year) , Exact Match)

=VLOOKUP(B3,B11:F19,MATCH(C3,B11:F11,0),FALSE)

We can keep index match match for more complex workbook.

Hi all, I need the opposite of that ..

I’ve a matrix , I want excel to lookup in this matrix for exact match to my lookup value then returns the left most column or the top most row ..

how to do that ?!!

Hi, This was a great explanation and I got it to work well! I want to tweak my formula a bit more so that it will do the index/match lookup below (formula is working) but also use the information found on different worksheets within the same workbook — automatically changing the formula based on a column that contains the name of the workbook to use automatically… perhaps a INDIRECT command???

My main worksheet is called ‘JaxDentist’ There are various worksheets in the same workbook that are used to look up the information and return it to JaxDentist. Examples of the secondary worksheets being used to return data for the index match are called 315-09E, 310-13E, 155-16A, etc. On my worksheet Jax Dentist where data is being returned to, I have a column set up “X” that contains the name of the correct worksheet that excel should use to do the INDEX MATCH, but I can’t figure out the complete formula….

So here is my working formula for a cell to look up info on worksheet ‘315-09E’ for the data.

=INDEX(‘315-09E’!$A$14:$R$37,MATCH($U353,INDEX(‘315-09E’!$A$14:$R$37,,1),0),MATCH($Y353,INDEX(‘315-09E’!$A$14:$R$37,1,),0))

This is working correctly, as long as I specifically name it in the formula which worksheet to us to use (right now called 315-09E)… I

Here’s a second example of a working formula from a different row. This uses a another worksheet to return the same formatted (but different values) using the INDEX/MATCH

now using worksheet to look up “310-13E” so the working formula is =INDEX(‘310-13E’!$A$14:$R$37,MATCH($U353,INDEX(310-13E’!$A$14:$R$37,,1),0),MATCH($Y353,INDEX(‘310-13E’!$A$14:$R$37,1,),0))

I have a column “X” in my JaxDentist worksheet that has the names of the worksheets that excel should use automatically use/substitute into the formula…

How can I change these formulas so it will do continue to do the index match, but also variably also use the worksheet name that is contained in the column x of worksheet “JaxDentist” rather than me specifically naming the worksheet. I keep reading about INDIRECT command but can’t get it to integrate with the INDEX MATCH FORMULAs above. The data I am working with has thousands of lookups to do across 15-20 different worksheets in the same workbook.

Is there any alternative to adding multiple Index Match functions together? For example, I have about 30 columns with numbers in them, and I am currently using Index Match when I have 3 or 4 dollar amounts to add together for the total. However, I now need to add all 30 columns together to find the total for operating profit (which is a row) for example. I can’t use a smiple Sum formula, because each month the number of columns may change.

Any thoughts?

I corrupted this formula somehow, and when i try to correct the vertical lookup value, “Sum!$A$3” to “Sum!$A$2” I get an error message that reads “The value you entered is not valid.” Am in a Windows 7 Pro environment in Excel 13. Thanks for any thoughts

=INDEX(Data!$A$4:$BA$61,MATCH(Sum!$A3,Data!$A$4:$A$61,0),MATCH(D$1,Data!$A$3:$BA$3,0))

I am using the following code in order to identify the Facility number associated with a facility. I have 2 issues; firstly there are multiple facilities with the same or similar name and the code search requires an exact name to use for the search. So if I have “Store ABC” and “QCI Store” the code will not pull up either if I just enter Store.

How can I make the search more flexible to react on an incomplete name?

=PROPER(INDEX(‘Facility Database Download 2’!$A$3:$B$4600,SMALL(IF(‘Facility Database Download 2’!$A$3:$A$4600=$R$4,ROW(‘Facility Database Download 2’!$A$3:$A$4600)),ROW(1:1))-2,1))

I am adjusting the last 2 characters on eight extra lines to give me the 4 preceding and 4 post facilities based on the entered facility name however the requirement to enter the facility name exactly as it is in the database is very restrictive. Grateful for any help or advice.

this is awesome! got my assignment done because of this! thanks!!!!!!!!!!!

Hi,

Need help…

I have Three columns Col1- Rest Name, Col2-Locality col3-status. This is my Master Data.

Now, In another sheet I have Rest Name and Locality. Now, if Rest name and locality is match then it should give status in the third column.

Hello! I need to fit an item to a selection of crates. Is there a variation of this formula that will allow me to find all of the crates with dimensions greater than the item?

Item dims = 51 x 47 x 35

array of available crate sizes is as follows

Crate # L W H

1 124 63 55

2 79 37 79

3 57 52 46

4 64 36 54

5 93 64 39

6 93 63 63

I have a table which has clients in one column who are assigned to a risk rating,in descending numeric order in another. I need to find a way to take the top & bottom 5. I can do the index match but I do not want redundancies . so if i have 2 client names with the same risk score, I want to be able to list the first and the second and more if need be. this is what I have for 2 clients so far but it wont work if there is more than two. =IF(E8E7,INDEX(clients,MATCH(E8,rating,0)),INDIRECT(“A”&ROW(INDEX(clients,MATCH(E8,rating,0)+1))))

any suggestions?

{ 5 trackbacks }