In the VLOOKUP article, we have looked at some limitations with the VLOOKUP function in Excel. For example, we must start from the leftmost column and look up values on the righthand side. Similarly with HLOOKUP, we must start from the top row and look for values downwards. So if you are looking for a more flexible formula in Excel, INDEX and MATCH functions could be your solution. And they are simple to use. First we will go through the INDEX and MATCH functions separately and then we will explore how they can be used together to do a lookup.

Index Function

The purpose of the INDEX Function in Excel is to:

Let’s have a look at the example below. Here we are looking into the A1:C14 array of data and specifically, we want the data in Row 5 and Column 3:

Index-Function-Excel

=INDEX(A1:C14, 5, 3)

Match Function

The purpose of the MATCH Function in Excel is to:

Let’s have a look at the example below. Here we are looking into the array A1:A14 and specifically, we want to know where “Daniel H” is:

Match-Function-Excel

And as we can see, “Daniel H” is in Row 7 and is 7th down the row from A1.

Index Match Functions

Now let’s put the two together. As mentioned above, the INDEX function is:

We could now replace the row number or column number (or both) with a MATCH function. Remember, the MATCH function returns the position of a lookup value in a row or column. Once we have the position of the lookup value in a row (or column), we can also specify the column number (or row number) and the INDEX function will return the corresponding value in the array of data.

Example:

Index-Match-Function-Excel

=INDEX(A1:C14, MATCH(E5, A1:A14, 0), 3)

=INDEX(A1:C14, MATCH(E8, C1:C14, 0), 1)

For the first example, we want to find the Employee Number for “Daniel H”. We could easily use the VLOOKUP function (=VLOOKUP(E5, A1:C14, 3, FALSE)). But INDEX and MATCH can work perfectly as well. First we use MATCH function to look up “Daniel H” in A1:A14. This will return 7 as Daniel H is 7th down the list. The INDEX function then becomes =INDEX(A1:C14, 7, 3). 7th row and 3rd column, this will be “EMP0006”.

One thing VLOOKUP will not be able to do though is the second example – working from right to left. In this case, we have “EMP0002” and we want to find who the employee is. First we use the MATCH function to look up “EMP0002” along C1:C14. This will return 3 as EMP0002 is 3rd down the list. The INDEX function then becomes =INDEX(A1:C14, 3, 1). 3rd row and 1st column, this will be “Susan W”.

It works just as well if we replace column number with MATCH function:

Index-Row-Match-Excel

=INDEX(A1:C14, 8, MATCH(E5, A1:C10))

In this case, we want to find “June” amount for Darrin W. Let’s say we already know that Darrin W is in row 8, we then use MATCH function to find “June” across A1:C1 (“=MATCH(E5, A1:C1, 0)). This will return 2 as June is second across the row. The INDEX function becomes =INDEX(A1:C14, 8, 2). 8th row and 2nd column is “$8000”.

Index Match Match Function

Even better, we could replace both row number and column number in the INDEX function with MATCH functions:

Index-Match-Match-Excel

Let’s break this down:

Common Errors

We will now look at some of the common errors with Index & Match functions:

We hope you now understand how INDEX and MATCH functions work and common errors to look out for. Feel free to leave a comment if we’ve missed anything or if you have any feedback on this article!

Leave a Reply

Your email address will not be published. Required fields are marked *