INDEX & MATCH in Excel - better alternative to VLOOKUP

This tutorial shows how to use INDEX and MATCH in Excel and how it is better than VLOOKUP.

In a couple of recent articles, we made a good effort to explain the basics of VLOOKUP function to beginners and provide more complex VLOOKUP formula examples to power users. And now, I will try if not to talk you out of using VLOOKUP, then at least show you an alternative way to do a vertical lookup in Excel.

"What do I need that for?" you may wonder. Because VLOOKUP has numerous limitations that can prevent you from getting the desired result in many situations. On the other hand, the INDEX MATCH combination is more flexible and has many awesome features that make it superior to VLOOKUP in many respects.
Excel VLOOKUP or INDEX / MATCH - which is better?

Excel INDEX and MATCH functions - the basics

Since the aim of this tutorial is to demonstrate an alternative way to do a vlookup in Excel by using a combination of INDEX and MATCH functions, we won't dwell much on their syntax and uses. We will cover only the minimum necessary for understanding the general idea and then take an in-depth look at formula examples that reveal all the advantages of using INDEX MATCH instead of VLOOKUP.

INDEX function - syntax and usage

The Excel INDEX function returns a value in an array based on the row and column numbers you specify. The syntax of the INDEX function is straightforward:

INDEX(array, row_num, [column_num])

Here is a very simple explanation of each parameter:

  • array - a range of cells that you want to return a value from.
  • row_num - the row number in array from which you want to return a value. If omitted, the column_num is required.
  • column_num - the column number in array from which you want to return a value. If omitted, row_num is required.

For more information, please see Excel INDEX function.

And here is an example of the INDEX formula in its simplest form:

=INDEX(A1:C10,2,3)

The formula searches in cells A1 through C10 and returns a value of the cell in the 2nd row and the 3rd column, i.e. cell C2.

Very easy, right? However, when working with real data you would hardly ever know which row and column you want, that's where the MATCH function comes in handy.

MATCH function - syntax and usage

The Excel MATCH function searches for a lookup value in a range of cells and returns the relative position of that value in the range.

The syntax of the MATCH function is as follows:

MATCH(lookup_value, lookup_array, [match_type])
  • lookup_value - the number or text value you are looking for.
  • lookup_array - a range of cells being searched.
  • match_type - specifies whether to return an exact match or the nearest match:
    • 1 or omitted (default) - approximate match (next smaller).
    • 0 - exact match. In the INDEX / MATCH combination, you almost always need an exact match, so you set the third argument of your MATCH function to 0.
    • -1 - approximate match (next larger).

For example, if the range B1:B3 contains the values "New-York", "Paris", "London", the below formula returns the number 3, because "London" is the third entry in the range:

=MATCH("London",B1:B3,0)

For more information, please see Excel MATCH function.

At first sight, the usefulness of the MATCH function may seem questionable. Who cares about the position of a value in a range? What we do want to know is the value itself.

Let me remind you that the relative position of the lookup value (i.e. row and column numbers) is exactly what you need to supply to the row_num and column_num arguments of the INDEX function. As you remember, Excel INDEX can find the value at the juncture of a given row and column, but it cannot determine which exactly row and column you want.

How to use INDEX MATCH function in Excel

Now that you know the basics, I believe it has already started making sense how MATCH and INDEX work together. In a nutshell, INDEX finds the lookup value by column and row numbers, and MATCH provides those numbers. That's it!

For vertical lookup, you use the MATCH function only to determine the row number and supply the column range directly to INDEX:

INDEX(column to return a value from, MATCH(lookup value, column to look up against, 0))

Still having difficulties to figure that out? It might be easier to understand from an example. Suppose you have a list of national capitals and their population:
Source data for INDEX MATCH formula

To find the population of a certain capital, say the capital of Japan, use the following INDEX MATCH formula:

=INDEX(C2:C10, MATCH("Japan", A2:A10, 0))

Now, let's analyze what each component of this formula actually does:

  • The MATCH function searches for the lookup value "Japan" in the range A2:A10, and returns the number 3, because "Japan" is third in the lookup array.
  • The row number goes directly to the row_num argument of INDEX instructing it to return a value from that row.

So, the above formula turns into a simple INDEX(C2:C,3) that says to search in cells C2 through C10 and pull the value from the 3rd cell in that range, i.e. C4 because we start counting from the second row.

Don't want to hardcode the city in the formula? Input it in some cell, say F1, supply the cell reference to MATCH, and you will get a dynamic lookup formula:

=INDEX(C2:C10, MATCH(F1,A2:A10,0))
Excel INDEX MATCH formula

Important note! The number of rows in the array argument of INDEX should match the number of rows in the lookup_array argument of MATCH, otherwise the formula will produce an incorrect result.

Wait, wait… why don't we simply use the following Vlookup formula? What's the point in wasting time trying to figure out the arcane twists of Excel MATCH INDEX?

=VLOOKUP(F1, A2:C10, 3, FALSE)

In this case, no point at all :) This simple example is for demonstration purposes only, so that you get a feel of how the INDEX and MATCH functions work together. Other examples that follow below will show you the real power of this combination that easily copes with many complex scenarios when VLOOKUP stumbles.

Tips:

INDEX MATCH vs. VLOOKUP

When deciding which function to use for vertical lookups, most Excel gurus agree that INDEX MATCH is far better than VLOOKUP. However, many people still stay with VLOOKUP, firstly, because it's simpler and, secondly, because they do not fully understand all benefits of using the INDEX MATCH formula in Excel. Without such understanding no one is willing to invest their time to learn a more complex syntax.

Below, I will point out the key advantages of MATCH INDEX over VLOOKUP, and you decide whether it's a worthy addition to your Excel arsenal.

4 main reasons to use INDEX MATCH instead of VLOOKUP

  1. Right to left lookup. As any educated user knows, VLOOKUP cannot look to its left, meaning your lookup value should always reside in the leftmost column of the table. INDEX MATCH can do left lookup with ease! The following example shows it in action: How to Vlookup a value to the left in Excel.
  2. Insert or delete columns safely. VLOOKUP formulas get broken or delivers incorrect results when a new column is deleted from or added to a lookup table because VLOOKUP's syntax requires specifying the index number of the column you want to pull the data from. Naturally, when you add or delete columns, the index number changes.

    With INDEX MATCH, you specify the return column range, not an index number. As the result, you are free to insert and remove as many columns as you want without worrying about updating every associated formula.

  3. No limit for a lookup value's size. When using the VLOOKUP function, the total length of your lookup criteria cannot exceed 255 characters, otherwise you will end up having the #VALUE! error. So, if your dataset contains long strings, INDEX MATCH is the only working solution.
  4. Higher processing speed. If your tables are relatively small, there will hardly be any significant difference in Excel performance. But if your worksheets contain hundreds or thousands of rows, and consequently hundreds or thousands of formulas, MATCH INDEX will work much faster than VLOOKUP because Excel will have to process only the lookup and return columns rather than the entire table array.

    VLOOKUP's impact on Excel's performance may be especially noticeable if your workbook contains complex array formulas like VLOOKUP and SUM. The point is that checking each value in the array requires a separate call of the VLOOKUP function. So, the more values your array contains and the more array formulas you have in a workbook, the slower Excel performs.

To discover the nuanced differences between INDEX MATCH and XLOOKUP, explore the in-depth analysis in this guide: Excel XLOOKUP vs INDEX MATCH.

Excel INDEX MATCH - formula examples

Knowing the reasons to learn the MATCH INDEX function, let's get to the most interesting part and see how you can apply the theoretical knowledge in practice.

INDEX MATCH formula to look up from right to left

As already mentioned, VLOOKUP cannot look at its left. So, unless your lookup values are is the leftmost column, there's no chance that a Vlookup formula will bring you the result you want. The INDEX MATCH function in Excel is more versatile and does not really care where the lookup and return columns are located.

For this example, we will add the Rank column to the left of our sample table and try to figure out how the Russian capital, Moscow, ranks in terms of population.

With the lookup value in G1, use the following formula to search in C2:C10 and return a corresponding value from A2:A10:

=INDEX(A2:A10,MATCH(G1,C2:C10,0))
Look up values to left using INDEX MATCH

Tip. If you plan to use your INDEX MATCH formula for more than one cell, be sure to lock both ranges with absolute cell references (like $A$2:$A$10 and $C$2:4C$10) so they won't get distorted when copying the formula.

INDEX MATCH MATCH to search in rows and columns

In the above examples, we used INDEX MATCH as the replacement for classic VLOOKUP to return a value from a predefined one-column range. But what if you need to look up in multiple rows and columns? In other words, what if you want to perform the so-called matrix or two-way lookup?

This may sound tricky, but the formula is very similar to the basic Excel INDEX MATCH function, with just one difference. Guess what?

Simply, use two MATCH functions – one to get a row number and the other to get a column number. And I congratulate those of you who have guessed right :)

INDEX(array, MATCH(vlookup value, column to look up against, 0), MATCH(hlookup value, row to look up against, 0))

And now, please take a look at the below table and let's build an INDEX MATCH MATCH formula to find the population (in millions) in a given country for a given year.

With the target country in G1 (vlookup value) and the target year in G2 (hlookup value), the formula takes this shape:

=INDEX(B2:D11, MATCH(G1,A2:A11,0), MATCH(G2,B1:D1,0))
INDEX MATCH MATCH formula for two-way lookup in Excel

How this formula works

Whenever you need to understand a complex Excel formula, break it down into smaller parts and see what each individual function does:

MATCH(G1,A2:A11,0) – searches through A2:A11 for the value in cell G1 ("China") and returns its position, which is 2.

MATCH(G2,B1:D1,0)) – searches through B1:D1 to get the position of the value in cell G2 ("2015"), which is 3.

The above row and column numbers go to the corresponding arguments of the INDEX function:

INDEX(B2:D11, 2, 3)

As the result, you get a value at the intersection of the 2nd row and 3rd column in the range B2:D11, which is the value in cell D3. Easy? Yep!

Excel INDEX MATCH to look up multiple criteria

If you had a chance to read our Excel VLOOKUP tutorial, you have probably already tested a formula to Vlookup with multiple criteria. However, a significant limitation of that approach is the necessity to add a helper column. The good news is that Excel's INDEX MATCH function can look up with two or more criteria too, without modifying or restructuring your source data!

Here's the generic INDEX MATCH formula with multiple criteria:

{=INDEX(return_range, MATCH(1, (criteria1=range1) * (criteria2=range2), 0))}

Note. This is an array formula that must be completed with the Ctrl + Shift + Enter shortcut.

In the sample table below, supposing you want to find the amount based on 2 criteria, Customer and Product.

The following INDEX MATCH formula works a treat:

=INDEX(C2:C10, MATCH(1, (F1=A2:A10) * (F2=B2:B10), 0))

Where C2:C10 is the range to return a value from, F1 is criteria1, A2:A10 is the range to compare against criteria1, F2 is criteria 2, and B2:B10 is the range to compare against criteria2.

Remember to enter the formula correctly by pressing Ctrl + Shift + Enter, and Excel will automatically enclose it curly brackets as shown in the screenshot:
The INDEX MATCH formula to look up multiple criteria

If you'd rather not use array formulas in your worksheets, add one more INDEX function to the formula and complete it with a usual Enter hit:
A non-array INDEX MATCH formula with multiple criteria

How these formulas work

The formulas use the same approach as the basic INDEX MATCH function that looks through a single column. To evaluate multiple criteria, you create two or more arrays of TRUE and FALSE values that represent matches and non-matches for each individual criterion, and then multiply the corresponding elements of these arrays. The multiplication operation converts TRUE and FALSE into 1 and 0, respectively, and produces an array where 1's correspond to rows that match all the criteria. The MATCH function with a lookup value of 1 finds the first "1" in the array and passes its position to INDEX, which returns a value in this row from the specified column.

The non-array formula relies on the ability of the INDEX function to handle arrays natively. The second INDEX is configured with 0 row_num so that it will pass the entire column array to MATCH.

That is a high-level explanation of the formula's logic. For full details, please see Excel INDEX MATCH with multiple criteria.

Excel INDEX MATCH with AVERAGE, MAX, MIN

Microsoft Excel has special functions to find a minimum, maximum and average value in a range. But what if you need to get a value from another cell that is associated with those values? In this case, use the MAX, MIN or AVERAGE function together with INDEX MATCH.

INDEX MATCH with MAX

To find the largest value in column D and return a value from column C in the same row, use this formula:

=INDEX(C2:C10, MATCH(MAX(D2:D10), D2:D10, 0))

INDEX MATCH with MIN

To locate the smallest value in column D and pull an associated value from column C, use this one:

=INDEX(C2:C10, MATCH(MIN(D2:D10), D2:D10, 0))

INDEX MATCH with AVERAGE

To work out the value closest to the average in D2:D10 and get a corresponding value from column C, this is the formula to use:

=INDEX(C2:C10, MATCH(AVERAGE(D2:D10), D2:D10, -1 ))

Depending on how your data is organized, supply either 1 or -1 to the third argument (match_type) of the MATCH function:

  • If your lookup column (column D in our case) is sorted ascending, put 1. The formula will calculate the largest value that is less than or equal to the average value.
  • If your lookup column is sorted descending, enter -1. The formula will compute the smallest value that is greater than or equal to the average value.
  • If your lookup array contains a value exactly equal to the average, you can enter 0 for exact match. No sorting is required.

In our example, the populations in column D are sorted in descending order, so we use -1 for match type. As the result, we get "Tokyo" since its population (13,189,000) is the closest match that is greater than average (12,269,006).
Using INDEX MATCH with AVERAGE, MAX, MIN

You may be curious to know that VLOOKUP can perform such calculations too, but as an array formula: VLOOKUP with AVERAGE, MAX, MIN.

Using INDEX MATCH with IFNA / IFERROR

As you have probably noticed, if an INDEX MATCH formula in Excel cannot find a lookup value, it produces an #N/A error. If you wish to replace the standard error notation with something more meaningful, wrap your INDEX MATCH formula in the IFNA function. For example:

=IFNA(INDEX(C2:C10, MATCH(F1,A2:A10,0)), "No match is found")

And now, if someone inputs a lookup table that does not exist in the lookup range, the formula will explicitly inform the user that no match is found:
Using INDEX / MATCH with IFNA function to trap N/A errors

If you'd like to catch all errors, not only #N/A, use the IFERROR function instead of IFNA:

=IFERROR(INDEX(C2:C10, MATCH(F1,A2:A10,0)), "Oops, something went wrong!")

Please keep in mind that in many situations it might be unwise to disguise all errors because they alert you about possible faults in your formula.

That's how to use INDEX and MATCH in Excel. I hope our formula examples will prove helpful for you and look forward to seeing you on our blog next week!

Practice workbook for download

Excel INDEX MATCH examples (.xlsx file)

600 comments

  1. Hi, Firstly, I thank you for providing this excellent service. You are doing a great service.I need some help with this. I want to send/link cells or rows to another worksheet/book when they meet certain criteria.
    For example, if the date and time attended in column D and E is later than a day or 10 hrs compared to column B and C and link those data that match criteria to another sheet.
    Thank you and hope to hear from you soon.

  2. Hi,

    Please can you advise how to solve with Index & Match for 2 rows & 1 column criteria as follows

    Row ---- Employee Contribution
    Row ---- Employer Contribution

    Column --- Employee No.

    Please advise how could I bring the values from data in another sheet using Index & Match or any other alternative function.

    thanks and regards,
    Santosh

  3. Svetlana,
    I think I have the formula correct for the Index/Match with multiple criteria, however I can't seem to make the { } register and execute the formula.
    Running Excel 2010
    {=INDEX([19122014.xlsx]Sheet2!$A$1:$N$24596, MATCH(1,(C3=[19122014.xlsx]Sheet2!$B$2:$B$24596) * (E3=[19122014.xlsx]Sheet2!$F$2:$F$24596),0),12)}

    Please help.
    liz

  4. Hi Svetlana,

    Need your expert help, I am new user to complex Excel functions as have never used anything beyond sum/average/max. I am trying to use Index/Match in a scenario where based on matching account in a cell, need to sum data from 12 months column in that row. similar to example you have given for Vlookup & sum function. But I am not able to figure out how to use it.

    Is this correct Sumif?
    =SUMIF(Trend!$A$6:$A$16,$J18,Trend!$C6:$N6)
    It is giving only single cell value of Trend!$c6 instead of sum c6:n6
    or I have to use Index/Match, if so then what will syntax?

    Thanks in advance
    regards
    Piyush

    I know it is silly.

  5. I have two sheets with data that I need to match up in the following way:

    Sheet 1:
    Col A = Company name
    Col B = Company address
    Col C = Rent

    Sheet 2:
    Col A = Company name
    Col B = Company address

    The hard part is that on sheet 1 the list has different company names for the same address in multiple rows. Example:

    ABC Inc, 123 Main St., $500
    XYZ Inc, 456 Main Ave, $600
    GHI Corp, 123 Main St, $550

    I need to match the most recent (highest row number) or BOTH the company name and address with those on Sheet 2 and return the RENT from Sheet 1.

    I have a feeling that this is going to require diving into VBA.

    I have tried using INDEX and MATCH functions with helper columns but I can't get it to match BOTH cells.

    Thanks

  6. Hi Svetlana,

    Great post.

    Using your dateset for the 'How to use INDEX MATCH to search by row and column values example', how could you answer the question:

    "By what year was the population of USA >= 300,000,000?" The answer should be 2015.

    Essentially I have a very similar data set and I want to output a column title value, with the row title and a specific value as input.

    Thanks!

    Hugh

  7. Hi there,

    how could I do multiply array match? Thanks very much!

    25 is the value to match with the data set below:

    a b c d e f g h
    60 60 60 60 60 60 60 60
    120 120 120 120 120 120 120 120
    200 200 200 200 200 200 200 200
    80 110 110 110 110 110 110 110
    25 25 25 25 25 25 25 25
    25 25 25 25 25 25 25 25
    22 22 22 22 22 22 22 22
    70 70 70 70 70 70 70 70
    120 120 120 120 120 120 120 120
    50 80 80 80 80 80 80 80
    10 15 15 15 15 15 15 15
    15 15 15 15 15 15 15 15

    Regards,
    Jana

  8. Hi Svetlana,

    I am using the index/match function successfully, however I have a set of data that has the lookup value for the match function listed multiple times in the data set. Is there a way to choose the lookup value based on the value of the corresponding indexed data value. For example:

    A B
    1 Joe
    2 Bob
    3 Joe
    4 Sally
    5 Joe

    How would I get the function to return the value 5 from column A rather than 1?

    Thanks,
    Chris

  9. Hi Svetlana,

    I am using the index/match function successfully, however I have a set of data that has the lookup value for the match function listed multiple times in the data set. Is there a way to choose the lookup value based on the value of the corresponding indexed data value. For example:

    A B
    1

  10. Hi
    I have a fleet of truck and want to manage daily expense on fuel my work is to dispatch goods from a depot to different centres

  11. Hi there,

    Thank you for the excelent tutorial.

    I have been using Index Match function with success for many years.

    Now I have come up with a new issue. I would like the column num in the function to pick only the second (or third or fourth) line of a cell instead of all of the cell data. Is that doable ?

    Thanks

    Nick

  12. Hi All

    I just recently discovered and learnt to love VLOOKUP and now I read about an even more powerful function. However, the core problem for me remains that in the end we are looking for exact matches here. If one has to be searching on text this is a fairly unrealistic precondition.

    We have about 41k company names in our database of which some are in relation with others while others are not. Also, we still have dirty data which complicates the issue even more. So we'd have:
    "ABC Company Inc." (Main Seat)
    "ABC Company Germany"
    "ABC Company USA"
    "ABC Company" (dirty data record, actually main seat)
    "Company ABC" (totally different company)

    Now those companies can participate on fairs. From the fairs we receive a table of names of companies who participate - from their database. So the naming for the exact same company will very likely be different. The table from the fair exhibitor features up to 5 columns that I need on my master table from my database. On the master table I have a full company name and a short name which does not include business entity type. Also, our master table has a column with the website and so does the fair exhibitor table.

    I would say that if 2 out of 3 prerequisites match (From Name, Short Name & Website; using wildcards on both ends of the search strings) I could perform the Index lookup. I can still not be completely sure that the result is 100% accurate but it should reduce the manual labor afterwards.

    Do you have any insights or best practice advices for a scenario like mine?

    Best
    Roger

  13. Hi Svetlana,
    I was hoping that you might be able to help me with the functions to find the Max, Min and Average between two dates with a list of dates with data.

    I cannot get the min function to work.
    B C G H I J
    2 1/01/2013 0:00 0.887 Max Min Ave
    3 1/01/2013 0:00 0.952 1/01/2013 0:00 0.952 MIN(INDEX(($B$2:$B$50>=G3)*($B$2:B$50=G4)*($B$2:B$50=G3)*($B$2:B$50=G4)*($B$2:B$50<=G5)*$C$2:$C$50,))
    5 1/01/2013 0:00 0.745 3/01/2013 0:00
    6 1/01/2013 0:00 0.644 4/01/2013 0:00
    7 1/01/2013 0:00 0.745
    8 1/01/2013 0:00 0.845
    9 1/01/2013 0:00 0.945
    10 1/01/2013 0:00 0.845
    11 1/01/2013 0:00 0.742
    12 1/01/2013 0:00 0.842
    13 1/01/2013 0:00 0.942
    14 1/01/2013 0:00 0.842
    15 1/01/2013 0:00 0.742
    16 1/01/2013 0:00 0.642
    17 1/01/2013 0:00 0.614
    18 1/01/2013 0:00 0.542
    19 1/01/2013 0:00 0.642
    20 1/01/2013 0:00 0.542
    21 1/01/2013 0:00 0.442
    22 1/01/2013 0:00 0.341
    23 1/01/2013 0:00 0.441
    24 1/01/2013 0:00 0.541
    25 1/01/2013 0:00 0.559
    26 1/01/2013 0:00 0.550
    27 1/01/2013 0:00 0.439
    28 1/01/2013 0:00 0.339
    29 1/01/2013 0:00 0.439
    30 1/01/2013 0:00 0.539
    31 1/01/2013 0:00 0.437
    32 1/01/2013 0:00 0.336
    33 1/01/2013 0:00 0.436
    34 1/01/2013 0:00 0.536
    35 2/01/2013 0:00 0.544
    36 2/01/2013 0:00 0.433
    37 2/01/2013 0:00 0.332
    38 2/01/2013 0:00 0.432

  14. Svetlana, thank you for your article. I hope you can help with a related problem I'm having!

    In my worksheet titled “Data!” I have the following successful formula:

    =SUM(INDIRECT(CHAR(64+MATCH(E3,A3:N3,0))&MATCH($B165,$A$1:$A$900,0)&":"&(CHAR(64+MATCH(E3,A3:N3,0))&MATCH($B165,$A$1:$A$900,0)+$O$2-1)))

    Please don't bother with the details, as my problem is related to referencing another spreadsheet, as explained below. But in sum, the above formula works as intended by summing cells E124 to E133. In cell E3 I have the desired column name. In B165 I have the desired year.

    I need the formula to be in a different worksheet. So, in my second worksheet I’ve written:

    =SUM(INDIRECT("Data!"&(CHAR(64+MATCH(Data!E3,Data!A3:N3,0))&MATCH($O3,Data!A1:A900,0)&":"&"Data!"&(CHAR(64+MATCH(Data!E3,Data!A3:N3,0)&MATCH($O$3,Data!A1:A900,0)))))

    However, this brings me a #VALUE error.

    When I break the formula into two parts it works.

    That is, this works:
    CHAR(64+MATCH(Data!E3,Data!A3:N3,0))&MATCH($O3,Data!A1:A900,0)

    And this works:
    (CHAR(64+MATCH(Data!E3,Data!A3:N3,0)&MATCH($O$3,Data!A1:A900,0)))

    But when I combine the two it breaks down. I suppose that the error has to do with the first instance of "Data!" below where I reference my initial worksheet.

    =SUM(INDIRECT("Data!"&(CHAR(64+MATCH(Data!E3,Data!A3:N3,0))&MATCH($O3,Data!A1:A900,0)&":"&(CHAR(64+MATCH(Data!E3,Data!A3:N3,0)&MATCH($O$3,Data!A1:A900,0))))))

    Any guidance would be greatly appreciated!!

  15. Hello, I have been using the index/match formula for years to match data from multiple worksheets on a master sheet. However, after we updated to Excel 2013 the formula no longer works, I know I'm entering it in correctly but it does not return any data, no error code it just puts a 0 in the cell? Have you come across anyone else with this issue? And do you have any fixes for it?

    thank you!

  16. Hi Svetlana!!
    I need help with an excel file....I have 2 seperate files with similiar data....Phone #'s and Department #'s on one and Phone #'s on another.....I want to move the Depatment #'s to the 2nd file using the Phone # as matches.....what kind of formula can do this.....Thx Joe

  17. FYI - MATCH does not work with lookup strings greater than 255 either (as of 2013).

    It also returns a VALUE error.

  18. =INDEX(Sheet2!$A$2:$D$5049,MATCH(1,(BC2=Sheet2!$A$2:A5049) * (BD2=Sheet2!$B$2:B5049),0),4)

    Sheet1 ( Column BE and BF needs to filled from Sheet2 matching the values in

    Column BC and BD to A and B in sheet2)
    BC BD BE BF
    Bradbury 2560
    BUSBY 2168

    Sheet2
    A B C D
    BRADBURY 2560 -34.084468 150.829041
    BUSBY 2168 -33.917587 150.899095

    • Its not working for me. Below is the formula is used

      =INDEX(Sheet2!$A$2:$D$5049,MATCH(1,(BC2=Sheet2!$A$2:$A$5049) * (BD2=Sheet2!$B$2:$B$5049),0),3)

    • Hi Jag,

      Your formula is correct, just use index 3 for column BE:

      BE: =INDEX(Sheet2!$A$2:$D$5049,MATCH(1,(BC2=Sheet2!$A$2:A5049) * (BD2=Sheet2!$B$2:B5049),0),3)
      BF: =INDEX(Sheet2!$A$2:$D$5049,MATCH(1,(BC2=Sheet2!$A$2:A5049) * (BD2=Sheet2!$B$2:B5049),0),4)

      If you mean something different, please clarify.

  19. Hi,

    I have 2 rows
    Type 1 6 6 1 2 3 7 8
    Value 12 21 11 23 41 65 07 80

    Enter 1
    Result 12

    Enter 6
    Result 11

    Enter 4
    Result 12

    Enter 9
    Result 07

    Basically I need to get the minimum value if the value matches or else minimum value of all the denominations that are lesser.

    I would really appreciate f you can help me with this in any way.

    • Thanks got a way around :)

  20. Hi

    I've got a tricky one for you.

    I've got a table with 5 columns. We've got various engineering disciplines - civil, mechanical, electrical etc. with various grades of engineers - senior, principal, technician etc. Each has a specific charge out rate for 3 different work locations. I want to link another work sheet and populate a row across the top using pull down lists so any of the 3 combinations on discipline, grade and office pops the right rate into the boxes so I can build up an estimate.

    Any ideas?

  21. Thank you for those explanations, you literally saved my life from hours and hours and more.. hours of work :o)

    God bless you for giving us this explanation!

  22. Hi there!

    I have a worksheet with range (which is similar to a tax schedule) - Column A representing Minimum Value and Column B as Maximum values. Column C contains values if an amount is within the range of Column A and B. E.g.

    Worksheet 1

    Column A Column B Column C
    1 100 50
    101 200 75
    201 300 100

    Worksheet 2

    78
    220
    115

    What I would like is a formula/function to get the corresponding value from Column C in worksheet 1 if the value in worksheet 2 is within the Minimum and Maximum range from worksheet 1.

    Thank you!

    • =INDEX(D2:D4,SUMPRODUCT(--(B7=B2:B4),ROW(A1:A3)))

      A B C D
      1 min max Output
      2 1 100 50
      3 101 200 75
      4 201 300 100

  23. how to find same value or number in excel.

  24. how to find same value or number in excel

  25. Hi,

    For the example you showed on "Look up with multiple criteria using INDEX MATCH", what if my table's results are showed in horizontal instead of vertical? Is there any way I can make it look up and return the correct data without having to transpose the table? For example in the table below, I am trying to match the Lab and the Test and wanted it to return results for Test 1 for my first column and Test 2 for my second column. How do I make it to return the data in row 4 instead of column 3 like the example shown? Is there any way to achieve this? Thanks in advance!

    Lab E Lab E Lab E Lab C Lab C Lab A
    Ash Calcium Free L-CarnitineChlorideCobalt Copper
    % % ppm % ppm ppm
    Test #1 1.63 0.21 147.7 0.21 <0.20 4
    Test #2 1.46 0.23 152.2 0.22 <0.20 4

    • Hi Angie,

      When you are trying to match the Lab and the Test, do you have several Lab records for one Test? If you can send a sample workbook with your data to support@ablebits.com and include the result you expect to get, our support team will try to help.

  26. Hi,
    I want to compare two sheets sheet 1 and sheet 2,after comparing them both the sheets values inthe sheet should be merged and arranged in the ascending order.
    can you please suggest me .

    Thanks,

  27. Please good you help with my formula.

    I keep getting you've entered too many arguments for this function

    =INDEX('Pivot by breachQH'!$A:$Z,MATCH($A$1,'Pivot by breachQH'!A:A,0),MATCH(B$4,'Pivot by breachQH'!$4:$4,0,MATCH("Majors-Lite",'Pivot by breachQH'!))))

  28. Hi! Thanks for the very informative article!

    I was wondering how you would alter the "Multiple Criteria Using INDEX MATCH" formula if, for instance, Dan Brown bought apples more than one time so there are repeats of names and what they bought, and you are only interested in the first time they bought apples. Thanks!

  29. Hello,

    I have 2 tables:
    table 1
    BH151¦20.53
    BH151¦20.5
    BH152¦20.99
    BH152¦21.99

    Table 2
    BH151 ¦20.01¦21.00¦X1
    BH152 ¦20.01¦22.00¦X2

    I would like a formula that looks for the value in table 1 and report the X value from table 2. The value it needs to check first is in the first column of table 1 and then find the value from the second column. This value must be in between value of column 2 and 3 of table 2 in order to report the X value (column 4 of table 2)

    Many thanks,

    • i.e. I would like table 1 results to has follow:
      BH151¦20.53¦X1
      BH151¦20.5¦X1
      BH152¦20.99¦X2
      BH152¦21.99¦X2

  30. Hello,

    I want a solution for the following.
    I have 3 columns namely "State" , "City" , "Assessment rate"
    If i select a state , in city column it should load the cities of that particular state
    and then in city list which i got after selecting the , in that list if we search for any particular city , it should display all cities matching to the search key work and it should also display the max assessment value of that city.. for ex
    Output Required
    State city assessment rate CitySearch MatchingCities MaxAssessmentRate
    NY Manhattan 33.32 NEW West New York
    West New York 35.45 East New York 42.16
    East New York 42.16 south(New York)
    south(New York) 28.69

    Please Help me on this .. Thank you

  31. Hello,
    Thank you for your great article.
    I just used the Index Match Max Formula as per your examples, in order to get the person with the highest rank and it worked great when there is a unique person with the highest rank.
    However, in some cases, two or more people have the highest rank, but the formula only returns one name.
    Is it possible for the formula to return all the names of the people ranked one, or alternatively, have an error message if there are more than one result possible?

    Example:

    John 2
    Bob 4
    Will 4
    David 3
    =INDEX($B$2:$B$5, MATCH(MAX(C2:C5), C2:C5, 0))

    The result is Bob, and I would like to have both Bob and Will.

    Your help would be greatly appreciated.
    Kind regards,
    Marine

    • Hello Marine,

      You can show an error message if there are at least two people with the highest rank:
      =IF(LARGE(C2:C5,1)=LARGE(C2:C5,2),"error text", INDEX($B$2:$B$5, MATCH(MAX(C2:C5), C2:C5, 0)))

      • Thank you very much Svetlana.
        Is there a way to return both people with the highest rank?
        Kind regards,
        Marine

  32. =INDEX('1'!$A$9:$R$250,MATCH($A1,'1'!$A$9:$A$250,0),3)

    In the above I want to change the sheet reference shown as '1' above to what is in another cell.

    I have 10 sheets named 1 through to 10 in the workbook.

    I have a drop down list from which the user can choose a number from 1 to 10 indicating which sheet to use. If they chose 10 I want the sheet number 10 to appear etc. The formula above is showing sheet name 1.

    • Hello Harvey,

      You can use the INDIRECTfunction, the formula will be as follows:
      =INDEX(INDIRECT(A1&"!$R$9:$R$250"),MATCH($A1,INDIRECT(A1&"!$A$9:$A$250"),0),3)

      Where A1 is the cell from the drop-down list.

  33. Dear Svetlana,

    This is my first posting, though I used to get some excel guidance here.. Your feedback really helps me a lot!

    I had a "seems to be" simple problem, but after trying for some formula attemps, I still couldn't get it right..

    Here is how it look like:

    Data Source:
    111 112
    D | C D | C
    100 | 50 20 | 30

    Search Engine:
    D C
    111 xxx yyy

    I'm trying to make a simple "search engine", which, example.. when I put 111 on the search engine, it will "automatically" fill up the xxx & yyy with 100 & 50 from data source. So in this case there are 2 criterias that need to be obeyed by the formula. The "111" & the "D or C".

    I've managed to get the "xxx" section right with this formula: =INDEX($D$14:$IU$14,MATCH(C18,$D$11:$IU$11,0),MATCH(A18,$D$10:$IU$10,0))

    But as I used the same formula construction to the "yyy" section (by modifiying it to get the "C" part), it always appear "#Reff".. I don't know what's wrong with my formula's construction..

    Can you please help me with this case Svetlana?

    Thank you very much!

    Sincerely yours,
    Chris

  34. Sno_____Date_____Description_______Cr.__________Dr.________Total Balance
    1. 30/10/14 ________Mike__________3000______________________3000Cr
    2.___= _____________Mike _______________________500_________2500Cr
    3.___=______________Mike________________________3000________-500Dr
    4.___=______________Mike__________5000______________________4500Cr

  35. Hi Svetlana Cheusheva Madam,

    Hope You doing Well, I have Face with a little problems.I am trying To solve it.but I can't .If you could kindly help me.

    Sno_____Date_____Description_______Cr.__________Dr.________Total Balance
    1. 30/10/14 Mike 3000 3000Cr
    2. = Mike 500 2500Cr
    3. = Mike 3000 -500Dr

    If I draw The formula to below.then it must be an empty Cells to Bottom. when I enter the value & Information .Then to work Correctly ....
    Thanks

  36. Hi, Thanks for the great article, just wondering if the Index Match formula could return a second column cell from the same row, e.g. finds search value on row 249 and returns values in column 5 and column 12

  37. Hi,
    . Found the article very helpful and particularly this
    …… "...... When using the VLOOKUP function, remember that the total length of your lookup criteria should not exceed 255 characters, otherwise you will end up having the #VALUE! error. So, if your dataset contains long strings, INDEX MATCH is the only working solution. "
    ……
    Might just be worth noting that MATCH generally still has the 255 limit and the key to it working here in this particular formula:
    =INDEX(D5:D10,MATCH(TRUE,INDEX(B5:B10=A2,0),0))
    is that The value passed to MATCH in those cases is simply TRUE which is matched against an array of booleans and therefore the 255 character limit for MATCH is immaterial. (Thanks to RoryA at MrExcel Forum for pointing that out to me)
    . ( I got a bit confused later thinking that both INDEX and MATCH did not have the 255 limit
    Thanks
    Alan

  38. Thanks for this highly informative article.
    Which combination of Index, Match and Offset can I use to return rows with their contents?
    Much thanks

    • Hello Anthony,

      It depends on what exactly you want to get as the result : )

      If you have a lookup table from where you want to return the entire row, then it is better to add a helper column to a master table and get the row number using the Match function. If you want to put data in different columns, then you can use the Index function. If you want to pass the values from the lookup table to some function, e.g. Sum, then you'd better use Offset.

  39. I have a google spreadsheet that is generated from a google form. The form is filled out by admin each time a student is placed in ISS. The form puts information on the spreadsheet like student name, grade, offense, how many days of ISS assigned, and the dates the student is assigned to ISS (each date is a separate column with a max of 5 days/dates the student can be assigned). What I'm needing is for certain data from this spreadsheet to be pushed to another spreadsheet that's laid out by dates with about 15 rows under each date. I need to the students name to be pushed under the correct date(s) they were assigned. Therefore, making this second spreadsheet look like a list of students assigned ISS per day. This list is sent out so teachers can see which students of theirs (if any) are in ISS for that day. Is this possible? I created the first spreadsheet that's generated from the form/forms filled out to push students names into a google calendar under each day they are assigned (which I thought was pretty cool and provided the same effect as the list of students by date). However, admin doesn't "dig" the calendar view and wants the list in a spreadsheet form similar to what they are using. Which is the reason I am inquiring about how to make this work or if it's possible to make it happen.

    • Hello Amy,

      I am sorry, I have very little experience with Google Spreadsheets and therefore am unable to help. They are very similar to Excel, but not identical.

  40. My goal is to rank from highest to lowest a subset of numbers from a column based on certain values. What is the best way to accomplish this, as I can't seem to get it right using index, match and rank in various ways.

    Example:
    Col A has divisions names A-G
    Column B has the teams within each division 1-6 for each division
    Column C has a total score
    Column D to rank the teams with in each division, so I have a 1-6 ranking for each division

    Any help would be appreciated.
    Thanks!

  41. thanks so much for this absoloutly cool Post!
    Really Useful for me.
    thanks again ;)

  42. Great post! I've been looking for the perfect INDEX MATCH function for hours. Just added an IFERROR to replace the #N/A.

    Thanks!
    Linn

  43. Hi there,

    I had a query regarding some household budgeting I am commencing. My goal is to import bank transaction data and dump the transactions onto a xls sheet. Then I wish to run certain formula's over the data which allocates the expenses as I want them. For example, food bills may come from 5 different groceries, how do I build a formula that will let me allocate all 5 to the one account, being food. And so on with other expense categories?

    With thanks,

  44. Svetlana,

    I am trying to use the formula you set up for "Look up with multiple criteria using INDEX MATCH."

    I'm having trouble with the MATCH part of the formula:
    MATCH(1, (A2='Lookup table'!$A$2:$A$13) * (B2='Lookup table'!$B$2:$B$13))

    The problem I have is that this part of the formula (A2='Lookup table'!$A$2:$A$13) returns the value of the row in the array where the value is found, as does this part of the formula (B2='Lookup table'!$B$2:$B$13). It does not return 1 or 0 for true or false.

    So the comparison of MATCH(1, ...) is returning gibberish, and not the row where both parts of the A2 lookup and B2 lookup are true.

    Let me know if you want to see the files I'm trying to merge.

    Thanks.

  45. Hello Alex,

    The answer is "yes" to all 3 questions, though Excel is not the best way to implement your idea.

    1. You can use the Vlookup function to get the 2nd, 3rd and subsequent occurrences based on your reference cell. The lists can be of any length. For more details, please see this example.

    2. See this topic on the MrExcel forum.

  46. I don't really know under which function this applies, but I had a question about pulling formulas from references. The end goal is to create a sheet in which a process can be chosen from a drop-down menu and the next X rows will be populated with the X steps of the process selected. For example, if I have two input cells of side lengths of a triangle, I could select "Pythagorean Theorem" (all steps of the process would be on another sheet) from the drop-down list, and the next 4 rows will show "A^2", "B^2", "A^2 + B^2", and "SQRT(A^2 + B^2)", with the corresponding values based on my inputs next to them. However, if I pick "Area" from the list, it will calculate the area of that triangle with two steps (A*B and 1/2 A*B).

    So it essentially boils down to two or three questions:
    1) Can Excel display a full list based on a reference cell? If so, can those lists be different sizes?
    2) Can you pull a formula from another cell and have it operate on new input in the sheet it is being pulled into?

    Thanks!

  47. Need Help!

    I have created the below formula

    =LOOKUP("6070-24 · Cleaning SuppliesGarden",Sheet1!$E$1:$E$600,Sheet1!F$1:F$600)

    which basically say - look for "6070-24-Cleaning supplies Garden" on Sheet1 in coluwn E and take corresponding valve in Coluwn f. But I have more than one cleaning supplies account eg
    6070-24-Cleaning supplies Garden
    6070-25-Cleaning supplies MTC
    6070-25-Cleaning supplies Repairs

    I would like a formula which will read - sum all rows from coluwn F which begin with 6070 in coluwn E.

    Hope you understand

    • Hello Willie,

      Try the following SUMIF formula:
      =sumif(Sheet1!$E$1:$E$600, "6070*", Sheet1!$F$1:$F$600)

  48. Hi, I would really like if some one help me with my problem. The problem is Index/Match function is working fine to find unique MAX/MIN values but m not able to calculate the required data which contains repetitive values.

    Eg: PersonA - 100%, PersonB- 90% & PersonC100%. When m trying to find the Name and the value let say TOP 2, I am not getting Person A and Person B as both has got the max scores. Instead i am getting PersonA and Person A.

    Any solution with Index/Match or like that function to get the name of both the Person who has got similar values.

    • Hello Niraj,

      We have created an example for you, you can download it here. Hopefully, this is what you are looking for.

      • Hi,

        The example would be of great assistance, but unfortunately cannot find the page you r refering to. Is it possible to repost it?

        Thank you in advance.

        • Sorry, Alex, the link got broken during our blog engine's update. It's fixed now and here's a copy, just in case : )

  49. Thanks for a terrific article with a very lucid explanation of the subtleties of Index Match

    I have this formula which produces the answer I am expecting except when the value in B5 is repeated

    {(=Index('July 14'!A1:AQ500,Match(B5,'July 14'!$B$1:$B$500,0),Match(A5,'July 14'!$A$1:$AQ$1,0))}

    Is there an additional element I can add to overcome the problem of always finding the first occurrence in the source data

    Rob

    Rob

    • I have the same problem, Rob. I need to return a value (quantity) for each occurrence of a part number in the lookup table, the number may occur up to 10 times in the data column, each with a different quantity. I need to total the quantities for every part number.

      Thank you

  50. Hello again Svetlana,

    I'm not sure if this can be done using a Match/Index or Look Up formula, but let me know what you think.

    I have an Expenses sheet in an accounting work book with approx. 35 columns marked for various contracting expenses. Just to keep things brief, I have an "Expense Code" column (say column A) for each expense, e.g. Accounting has code 110, Bank Fees has code 111, Freight has code 112 and so on. The next column (say column B)has the "Expense Total" for each expense. The next column (say column C)has the "Amount to Allocate" totals [amount to allocate is the total expense less G.S.T.(goods & services tax)] and all the following columns are the various expense columns to which the "Amount to Allocate" figures are entered. I would like to formulate all the various expense columns to self-populate with the appropriate "Amount to Allocate" figures on recognising the expense code.

    Can formulas work in this scenario?

    Thanks in advance for any advice.

    Cheers,
    vcoolio.

    • Hi Vcoolio,

      I'm not sure I understand the task correctly. Please see the example we created and let me know if you want something different.

      • Dear Svetlana,

        That's it! Well done! The only thing is that the "Amount to Allocate" (column C)are the amounts to go into the various expense columns (D, E, F etc.)and not the "Expense Total" but this I can sort out for myself.
        The next thing is, will formulas work in this scenario? I have been toying with SUMIF formulas and they appear to work ok except for a couple of hitches. I'll see what you come up with and then we can put our heads together.

        Thanks a million.

        Cheers,
        vcoolio.

        • Dear Svetlana,

          Please ignore the following paragraph from my last post:-

          "The next thing is, will formulas work in this scenario? I have been toying with SUMIF formulas and they appear to work ok except for a couple of hitches. I'll see what you come up with and then we can put our heads together".

          The sample you sent to me was 'read only' so I could not access the formulas and for some reason I could not also access the second sheet with the table in it.
          However, I managed to get around this and I can access everything now. I now see what you have done and it is brilliant to say the least! It suits my purposes wonderfully.

          I have a couple of more questions for you:-

          1)As mentioned in my last post, the "Amount to Allocate" are the amounts that need to go into the various expense columns, so, in the formulas, should I just change the "B" into a "C" in the last section of the formulas?

          2)Quite often, I have a number of different expenses on the one invoice or statement. For example, if I have an invoice from a hardware store which totals $1,000.00, $500.00 of this amount may be for materials, $300.00 may be for tools and $200.00 may be for protective clothing. So, when I allocate the different amounts on the expenses spread sheet, they are all on the same row beside the supplier's (hardware store) name. Can the formulas be adjusted to allow for multiple entries on one row or would this just be complicating things somewhat?

          Again, many thanks for all that you have done.

          Cheers,
          vcoolio.

      • I would like to have the same but i need total of repeated expense code
        is it possible ??

        • Sumif can be use for the same

      • I would liketo have total of repeated expense code
        is it possible ??

        =INDEX(A1:F20,MATCH(H5,$A$1:$A$20,0),MATCH(H6,$A$1:$F$1,0))

        the above formula will solve only the amount but not for the repeated

      • I didn't get your example,and one more thing why there is a table in second sheet?

      • Dear
        From above example of index match to find a value of intersection what formula will be use to find intersection of value means in above index formula finds the population value of the intersection of usa in 2015 what if i need country and year by using population value??
        Hope i have described my point.

    • Hi Can you please help me to know how to choose from different price A & B & C & D and get the best price from these tnx.

    • Hi Svetlana Cheusheva

      Can you please help me to know how to choose from different price A & B & C & D and get the best price from these tnx.

    • Hi, please can you assist?
      I have four columns:
      1. Two columns of percentages and exposures and in
      2. Two seperate columns with percentages and exposures
      I want to match whether the percentages and totals in the one set is greater than or equal to the percentages in the other set and if they are; i need to input a message: "OK" or if they arent: "Incorrect".

      Is this possible.

      • Hello Sai,

        If you want to show the Message window (box), then a special VBA macro is needed. Sorry, I am not able to help with this.

    • This is very simple indeed!
      Proceed as follows:-

      In column B3, type 111
      In column C4, type 112
      In column B4, type Account Code
      In column C4, type Amount
      In column D4, type Bank Fees
      In column E4, type Freight
      Similarly, type other account heads F4, G4, H4, etc.
      Now the formula you need to post the expenses from the Amount (C4) column to the appropriate column where the code is located.
      In column C5, type 8,908 under amount column and type 111 in cell cell B5. This is assumed to be for bank fees.
      In order to make Excel post this to column D5, type the following formula in cell D5:
      =IF(B5=$B$3,C5,0).

      In cell C6, type 5,000 and type 112 in cell B6 for freight. Write the following formula in cell E5: =IF(B6=$C$3,C6,0)

      You should copy the above formulas down the columns to wherever your account postings are expected to get to. Please take careful note of the absolute referencing in cells B3 and C3. Joseph Osasebor, FCA, MBA

    • Below is the some amounts
      2,129
      8,938
      2,198
      12,977
      39,124
      1,219
      24,775
      1,287
      863
      3,723
      9,346

      in above amount if i Add few amount it will come 14535 .
      what is the formula for this in excel to calculated

    • Using Match/Index... I understand their functionality, and how to return the location of a 'match' into a specific cell. But... is there a way to return that entire ROW where the match is located?

    • Dear Sir,

      By using the index and match, we get the vaue. but i want the search and add multiple value from different rows.

      i can share the file, please provide the ur mail id.

Post a comment



Thank you for your comment!
When posting a question, please be very clear and concise. This will help us provide a quick and relevant solution to
your query. We cannot guarantee that we will answer every question, but we'll do our best :)