How to use INDEX and MATCH in Excel – The Everything Guide

INDEX MATCH, when combined, can change the approach you use to lookup values in Excel.

Yes, you get it right.

The combination of these two functions can match the gap of all other functions which we use for lookup.

Let me tell you how.

If you love to use VLOOKUP then I’m sure you have this secret pain inside: You can’t use it for advanced lookup (e.g. lookup to left).

Right?

But INDEX and MATCH can do this for you.

This combo formula is so flexible and powerful that you can lookup for a value in any direction.

Well, if you are still not convinced to use it, I have some facts and experts opinion to make it for you.

And after that, this monster guide will show you each and everything about combining and using INDEX with MATCH.

how to use index match in excel

...so without any further ado let's get started.

Why Should You Use INDEX MATCH

Here are some reasons why learning INDEX and MATCH is important:

Business Insider has ranked it in top 11 Excel skills to master. Hub Spot includes it on their 14 Excel tips to learn in 2017. And Chandoo listed it in one of the top 10 formulas for analysts.

What Experts Says

To get some real facts, I had a word with some of the experts in the community and tried to learn what are their views about INDEX and MATCH.

❝If you want to lookup values in any direction within your workbook/worksheet, then Index/Match is your tool.❞

John Michaloudis

❝I find using a combination of the INDEX and MATCH formula to be a really flexible and robust way of building formulas in Excel.❞

❝VLOOKUP had energy drink and turns into INDEX+MATCH to become more powerful.❞

Rahim Zulfiqar Ali

I am sure these are enough reasons for you to use INDEX and MATCH instead of using other functions and formulas.

And today, when you finish this guide, you will an advanced INDEX MATCH user as I have listed all the stuff you need to master it.

This guide is the biggest thing ever written on these two functions.

Benefits of Using INDEX MATCH in Excel

There's always a debate about INDEX and MATCH Vs. VLOOKUP.

Most of the people choose VLOOKUP because it’s easy to apply and even it’s easy to understand for a novice.

But, when you come to an elite category of users, and you are concerned about performance, flexibility, and power, this combination of index and match should be your first choice.

Ahead I have listed some points which will help you to make a better comparison.

#1. Lookup to Any Direction

The first and biggest reason for using INDEX and MATCH is you can look up to left or any other direction in your worksheet.

Unlike VLOOKUP, you can choose lookup column and result column independently. And, this ability makes it more powerful and flexible than any other lookup formula.

index match vs vlookup for left lookup

In the above example, we need to lookup for the amount of an invoice but with VLOOKUP we can't do that because amount column is on left side.

#2. Easy to Refer

In VLOOKUP, we need to specify the column number from which we want to return the value.

But on the other hand in index and match, we can directly refer to the value column and this makes it easy to use it.

index match vs vlookup not dynamic reference

In above table, we are using VLOOKUP to get the score according to roll number and if you want to use the name instead of roll number you need to change reference as well as col_index_number.

#3. Easy to Drag and Drop

In VLOOKUP, you need to refer to the entire table and you have to specify column index number and when you have to change the reference, you need to change the both.

But in INDEX and MATCH, wherever you need to change the reference, you just have to drag and drop it to another columns or rows.

index match vs vlookup not dynamic reference

In the above table, if we want to lookup with the name instead of roll number you just need to drag and drop the lookup column reference to name column using your mouse.

#4. Speed

In term of speed, INDEX/MATCH is far better than VLOOKUP. Charley Kyd from Excel User did a great speed confirmation test.

Insert Image

And, in his test results, he has clearly mentioned that INDEX and MATCH is the top most priority for lookup when it comes to speed.

#5. Adding or Removing Columns

index match removing columns 1

Quick Intro: INDEX and MATCH

Before you put together these functions you need to understand them individually. And, here you have a quick intro and syntax details about both.

What is INDEX Function

INDEX(array, row_num, [column_num])

Let’s say, we have a list of values in a column and you want to get particular value from that list.

The position of the value in the list is 6th row. So, now you need to refer to that column and specify the row which is 6.

Insert Image

And, index function will return that value. It’s is really simple to use but it can solve some complex for you.

What is MATCH Function

You just need to specify the column or row from which you want to match the value and the value to match.

MATCH (lookup_value, lookup_array, [match_type])

Let’s say you have a list of employees names and you want to check for a particular employee that where its name is in the list.

In match function, just need to enter the name in the employee and refer to the column or the row. And, it will return a number which will be the position of cell from column or row.

index match get value from row

How INDEX and MATCH Work Together?

To understand the working of INDEX and MATCH, a simple thing you need to pick:

  • MATCH tells the INDEX the position (cell number) of the value in a column or in a row.
  • And, then the INDEX returns the value using that position (cell number).

The whole power of this formula is in these two points.

Just think like this, MATCH function is an undercover agent who finds the criminal and INDEX function is a cop who arrests that criminal afterward.

index-match-getting-value

But, let’s learn this in detail how we can combine these two functions

Below is the syntax of INDEX, as you know.

INDEX(array, row_num, [column_num])

In INDEX function, row_num argument tells it, that from which row it has to return the value. Let’s say if you enter 4 it will return value from the 4th row.

To create INDEX MATCH formula we need to replace MATCH with row_argument of INDEX.

When we use MATCH, it looks up for the value from the lookup column and return the cell number of that value.

And then, INDEX use that number to figure out the position of the cell from the value column.

In the end, it returns the value from that cell and you get the value you are looking for.

But now, let’s work with a real example.

Below we have a list of cities and name of the employees who are working there.

index match sample formula enter

Here we need to lookup for the employee name who’s working in Mumbai.

Now, if look at data, in the column where you have cities, that is our lookup column and the column where you have employees name, that is your value column.

And, the formula will be:

=INDEX(B2:B11,MATCH(E3,A2:A11,0),0)

index match sample formula enter

Let’s break down this formula into two parts to understand it.

Part-1: In the part one, we have used the match function to lookup for the value “Mumbai” and it has returned the “5” which is the position of the cell in which you have value “Mumbai” in cities column.

index match how match works

Part-2: In the part two, we have used INDEX and referred employees name column for lookup of the value. Here index function knows that you want value from the 5th cell from the column. So, it has return “Arjun” in the result.

index match how index works

Top 14 Examples to use INDEX MATCH in Real Life

Ahead we have some of the common problems which we have solved using INDEX MATCH formula.

Get Instant Access to Sample Files

1. Basic lookup with INDEX MATCH

A normal lookup is one the most important task which you need to do with lookup formulas and INDEX MATCH is perfect for this.

Here we have a data table with employee ID and name. Each ID is unique and you need to lookup for employee’s name with his/her ID.

nomal lookup with index match data table

Let’s say you want to look up for the name of EMP-132. For this, the formula will be:

=INDEX(name_column,MATCH(emp-id,emp-id_column,0))

normal lookup with index match enter formula

Explanation:

First of all, MATCH matches the emp id in the emp id column and returns the cell number of id for which you are looking for. Here row number is 6.

normal lookup with index match match give row number

After that, INDEX returns the employee name from the name column using the same cell number.

normal lookup with index match index returns name

2. Lookup to Left

VLOOKUP can’t make it to the left while looking for a value. As I have mentioned, in INDEX and MATCH you can perform a lookup in any direction.

In the below data table, you have invoice number column after the amount column.

lookup to left with index match data table

So, if you want to look up for the amount of any particular invoice, this in not possible with VLOOKUP. In VLOOKUP when you select a table, the first column in that table will be the lookup column.

But, here in this table, we need to use the last column of the table as a lookup column. So, thumb down for VLOOKUP here.

Let’s call INDEX and MATCH for the rescue and the formula will be:

=INDEX(G2:G14,MATCH(L6,J2:J14,0),0)

lookup to left with index match enter formula

Explanation:

First of all, you have referred to the amount column in index function. This is the column from where we need to get the value.

Second, in the row_number argument of index function, you have used match function and specify the invoice number, referred to the invoice column and used zero for the exact match.

Third, match function returns the cell number of the invoice from the range,

lookup to left with index match returns row number

And in the end, INDEX use that number to return the amount by positioning the cell from the amount column.

lookup to left with index match returns amount

3. Approximate Lookup

Just like VLOOKUP, you can also use INDEX/MATCH for approximate lookup.

Approximate lookup can be useful when the value for which you are looking for is not there on the list and you want to get the closest match for that.

In the below table, you have a list of grades according to the marks.

approximate lookup index match data table min

And, if you want to get the grade for 79, you can use the below formula.

=INDEX(B2:B6,MATCH(D3,A2:A6,1))

approximate lookup index match enter formula min

Explanation:

In this formula, we have used 1 in the match function for the match_type which allows it to perform an approximate lookup.

It returns the first value which is lower than or equals to the lookup value.

approximate lookup index match returns grade

For 79, the first lowest value is 75 and for 75 grade is B. That’s why you get B in the result.

4. Horizontal LOOKUP

As you know HLOOKUP is for horizontal look up but you can also use INDEX and MATCH for this.

Here in the below data table, you have a horizontal table for monthly sales and you want to get the sales value for “May”.

horizontal lookup index match data row

And the formula will be:

=INDEX(amount,0,MATCH(lookup_month,months,0))

horizontal lookup index match enter formula

Explanation:

In the above formula, instead of using MATCH in row_num argument of index, we have used it in column_num.

And, match returns the column number of May month.

horizontal lookup index match returns column number

And then INDEX returns the value from the result column according to the position number.

horizontal lookup index match returns amount

5. Two Way Lookup

In a two-way lookup, we need to get a value from a table. Just have look at below table where you have zone wise and product wise sales amount.

two way lookup index match sales data

Now, if you want to get the sales amount of a product for a particular zone, you need a two-way lookup and for that, you need to use a combination of INDEX MATCH MATCH.

Yes, here you need to use MATCH twice.

In a normal combination of INDEX and MATCH, you use MATCH for the row number but in a two-way lookup, you need to use it for column number as well.

The formulas will be:

=INDEX(A1:F5,MATCH(H3,A1:F1,0),MATCH(H2,A1:A5,0))

two way lookup index match enter formula

Explanation:

In the above formula, to get sales amount from the table you have used index function and then match function for its row_num and column_num argument.

The match function which is the column_num argument returns 5 as the value Product-D in the 5th row in the range you have referred.

two way lookup index match returns row number

And, the match function which is in the row_num argument returns 2 as the value north zone is in the second column in the range you have referred.

two way lookup index match returns column number

Now with these values, index function has returned the value which is in the 2nd column and 5th row: 1456.

two way lookup index match returns sales amount

6. Case Sensitive

If you face a problem when you have two same values in a list or in a column but in the different text case, you can perform a case-sensitive lookup to look up for the right value.

Let’s have a look at below students list where you have the first name and in the second column you have scores.

case sensitive lookup index match student data

And, in first there are names which are same but in different text case.

For example, John Parker and JOHN Mathew. So let’s say, you want to look up for the marks of “JOHN” not “John“, you can create an exact match lookup with INDEX and MATCH.

And, the formula will be:

=INDEX(B2:B21,MATCH(TRUE,EXACT(E5,A2:A21),0))

case sensitive lookup index match enter formula

Explanation:

Here in this formula, you have used the EXACT function within the match function.

As match function is not able to lookup for a case sensitive value and EXACT is a perfect function for this.

It can compare two values and return TRUE is they are exactly the same (including the case) but you need to enter this formula as an array because you have to compare the entire column with a single value in EXACT.

When you enter it, it will return an array like this.

=INDEX(Sheet1!$B$2:$B$21,MATCH(TRUE,{FALSE;FALSE;FALSE;FALSE;FALSE;FALSE;FALSE;FALSE;FALSE;FALSE;FALSE;FALSE;FALSE;FALSE;FALSE;TRUE;FALSE;FALSE;FALSE;FALSE},0))

case sensitive lookup index match extact return array

From here, you need use match function so that you can get the position of TRUE from the array.

case sensitive lookup index match returns row number

At this point, you have the cell number (row number) of the value you need to look up. And, you can use INDEX to that value from column.

case sensitive lookup index match returns student score

Important Point: If you get more than one TRUE with EXACT, the match will just return the number for first TRUE

7. With Wildcards with INDEX MATCH

lookup wildcards index match data

From this list, you need to get the age of a particular employee (Sondra).

But the thing is you just know the first name.

And, if you use asterisk then you can look up for the age of Sondra using the first name.

For this, the formula will be:

=INDEX(B2:B11,MATCH(“Sondra*”,A2:A11,0),0)

lookup wildcards index match enter data

Explanation:

Asterisk is a wildcard character which can replace n number of characters. So, when you have used it after the first name it has replaced the last name.

lookup wildcards index match returns row number

8. Lowest Value

Let’s say you have a list of students with their scores like below. And now, from this list, you want to look up for the name of the student who has the lowest score.

lookup lowest value index match data

For this, you can use MIN function with index and match and the formula will be:

=INDEX(A2:A21,MATCH(MIN(B2:B21),B2:B21,0))

lookup lowest value index match enter formula

You have students name in column A and their scores in column B.

So, when you insert this formula in a cell and hit enter, it will return the name of the student with the lowest score i.e. Librada Bastian.

Explanation

In this formula, we have three different parts. In the first part, MIN function returns the lowest score.

lookup lowest value index match returns value

After that, in the second part, the match function returns the cell for that lowest score.

lookup lowest value index match returns row number

In the end, the index function returns the value from the student name column using the same cell position returned by match.

lookup lowest value index match return name

Quick Tip: In the same way, you can also get the name of the student who gets the highest score.

9. Top nth score

Now think like this, you have a list of students with their scores in exams and from this list, you want to get the name of the student who got the 2nd highest score.

top nth score index match data

The thing is you don't know what's the second highest score.

Normally, when you lookup for a value with lookup formulas, you are sure about the value for which you are looking for. But, here you don’t know what’s the second highest score.

So, for this, you can combine large function with index and match. The large function will help you to figure out the 2nd highest value from the range.

And, the formula will be:

=INDEX(student_names,MATCH(LARGE(score,2),score,0))

top nth score index match enter formula

Explanation:

In this formula, you have used the large function inside the match function for lookup_value argument. And in the large function, you have mentioned score range and 2 to get the second highest value.

top nth score index match large return second highest value

Once the large function returns the second largest value, match function used that value and returns the cell number for that.

top nth score index match return row number

And in the end, index function uses that cell number and returns the student name.

top nth score index match returns name

10. Multiple Criteria

Normally, the combination of index and match is meant to look up for a single value.

And that’s why you use a single range in the match function.

But, sometimes when you hit with data in the real world you need to use multiple criteria to lookup for a value.

Let’s take an example below.

Here you have a list of products with the multiple details like product name, category, and size.

And from this data, you want to get the price for a particular product using all the criteria.

multiple criteria index match data

So the formula will be:

=INDEX(D2:D11,MATCH(1,(A14=A2:A11)*(B14=B2:B11)*(C14=C2:C11),0))

multiple criteria index match enter formula

Note: This is an array formula, so you need to enter it using ctrl + shift + enter.

Explanation:

In this formula, you have three different arrays to match three different values and these arrays return TRUE and FALSE where values are matched.

After that, when you multiply them with each other you get an array something like this.

=INDEX(D2:D11,MATCH(1,{0;0;0;0;0;0;1;0;0;0},0))

And match function returns the position of 1 for the array.

multiple criteria index match return row number

In the end, INDEX returns the price from the price column using the number return by the match.

multiple criteria index match return unit price

11. First numeric value from a Range

Let’s say, you have a list in which you have both text and numeric values and now from this list, you want to get the first numeric value.

first numeric value index match data

For this, you can combine, ISNUMBER function with index/match. ISNUMBER can help you to identify which value is a number and which one is a text.

The formula will be:

=INDEX(list,MATCH(TRUE,ISNUMBER(list),0))

first numeric value index match enter formula

You need to enter this formula as an array (using Ctrl + Shift + Enter).

Explanation:

In this formula, ISNUMBER returns an array equals to the length of the list and in this array, you have TRUE for the values which are numbers and FALSE for the rest of the values.

first numeric value index match number array

After that, you have used TRUE in match function as a lookup value. So, it returns the position number of first TRUE from the array.

first numeric value index match returns row number

In the end, using that position number index returns the first numeric value.

48-first-numeric-value-index-match-return-first-number-min

12. Get First Non-Blank Value

Let’s think like this, you have a list of values where some of the first cells are blank and you want to get the first non-blank value.

first non blank index match data

And, you can use this formula to get that first non-blank value.

=INDEX(A2:A11,MATCH(FALSE,ISBLANK(A2:A11),0))

first non blank index match enter formula

Explanation:

We need to split this formula into three different parts to understand it wisely.

First of all, you have used ISBLANK function inside the match function to get an array where you have TRUE for blank cells and FALSE for non-blank cells.

first non blank index match isblank array

Second, MATCH returns the position number of first TRUE from the array returned by ISBLANK. So at this point, you have the cell number of first non-blank value.

first non blank index match returns row number

Third, index function simply returns the first non-blank value from the list.

first non blank index match returns value from first non blank cell

13. Most Frequently Occurring Text

Now let’s say from a list of text values you need to count the most frequently occurring text. In the list below, you have names. But, there are few names which are more than once.

most frequently occurring text index match data

So, now you need to get the name which has the highest occurrence in the list. You can use the below below formula which is a combination of MODE, INDEX, and MATCH.

=INDEX(A2:A13,MODE(MATCH(A2:A13,A2:A13,0)))

most frequently occurring text index match enter formula

When you insert this formula, it will return “Tamesha” which is the most occurring name.

Explanation:

First of all, MATCH will compare the entire range of names with itself. And, while doing this, it will return an array where each text will represent its first position.

Let’s takes an example of name “Tamesha” which is our most occurring name in the list. Now, if you look at the list, it has first occurred on 8th cell and after that on the 12th cell.

But, if you look at in the array, for all the positions where we have “Tamesha” it has returned 8 which is its first position.

most frequently occurring text index match array

After that, from the array returned by the MATCH, mode function will return the most frequent number which is the cell number of the first occurrence of “Tamesha”.

most frequently occurring text index match mode returns cell number

And in the end, INDEX will return the text by using that cell number.

most frequently occurring text index match return name

14. Create Hyperlink

Now, let’s say, along with looking for a value you also want to create a hyperlink for that value.

In this way, you can quickly navigate to the cell where your lookup is in the column.

For example, in the below table, you need to get the age of a person. And, if you create a hyperlink for this value you can easily go to the cell where that value is.

create hyperlink index match data

Explanation:

Let’s split this formula into parts to understand it in a better way.

First of all, you have used index and match inside the cell function. And, when you use these both functions within cell function, you get cell reference of the matched value instead of the matched value.

Second, you have concatenated “#” with the cell reference.

Third, you have again used index and match to get the matched value to use as a link text. In this way, you have the matched value as well as the link to the cell where that value is.

Sample Files

Get Instant Access to Sample Files

Conclusion

There is a huge force of Excel users who are not aware of INDEX MATCH. Even sometimes I got emails from my reader asking me about how can they perform a left lookup.

And, when I tell them about this method they always found it useful and more powerful.

I believe that most of the users shift to INDEX and MATCH from VLOOKUP when they need to perform a lookup to left, like my readers.

But, the point is how much you go beyond this one point. And, that is the reason I have compiled this monster guide and listed all these examples.

And, I am sure this will help you to make the best out of this combo of INDEX and MATCH.

But do we have more situations where we can use these functions?

Yes, of course, we have.

Now, it’s your time to help me out with a new idea where we can use INDEX MATCH combo.

Please share with me in the comment section, I would love to hear from you. And, don’t forget to share this guide with your friends.