Comments on: INDEX & MATCH in Excel - better alternative to VLOOKUP

This tutorial demonstrates the key strengths of Excel's INDEX / MATCH function that make it superior to VLOOKUP. You will find a number of formula examples that will help you easily cope with many complex tasks when VLOOKUP fails. Continue reading

Comments page 3. Total comments: 227

  1. Hi,

    Is it possible to do the index match function with an isblank formula?

    The index match formula works great, but returns a '0' when the cell is blank, I would rather it returned a blank cell.

    Many thanks
    Emma

    1. Hello, Emma,

      Here's a sample formula that may work for your task:
      =IF(ISBLANK(INDEX($D$2:$D$10,MATCH("Japan",$B$2:$B$10,0))), "", INDEX($D$2:$D$10,MATCH("Japan",$B$2:$B$10,0)))

  2. I am new to the Vlookup function, I feel I have a good grasp of it but one of my basic lookups is not working correctly. Ifyou look at test sheet, cell c24. The value is not returning correctly, there seems to be some math occurning and I cant figure out where it is. Any assistance?

    C24 - =IFERROR(VLOOKUP(A24,Sheet1!A2:B23,2),0)

    1. I was trying to post the xls but don't see an attachment option.

  3. In the table under #calculations-index-match, you refer to a function that gets the row number of the maximum value as one that gets the row number of the minimum value and vice versa. Also, near the top of the page, you refer to "MATCH(lookup_value, lookup_array, [match_type])" as the syntax of the INDEX function.

    1. I did not realize there were so many "bugs" in this post. I should probably find a good proofreader... Thanks again for pointing out those errors for me.

  4. In the first paragraph below #index-match-basics, where is says "a combination of INDEX and VLOOKUP functions", I believe you meant "a combination of INDEX and MATCH functions".

    1. Hi Hank,

      Spot on :) Thanks very much, fixed!

  5. Hi there, I really appriciate if you help me on vlookup on double values. I have purcasing # in one column and second column I have codes or numbers e.g., 30,20, 10 in a repetive way. I have to vlookup for anohter table that has purchasing # and codes and vlookup the 5th column that has comments. So I have to match purchasing # and code to other table and vlookup comments column.
    Hopefully i am clear.
    Ex:
    Purchacing # 1234567 code 20
    other table has the same data:
    Purchasing # 9876543 code 20 comments(column)
    Could you please kindly help to come up with formula.
    I inserted helping formula but I would like to use different formula without inserting any column. Plus I have a big data and vlookup can do up to 250 cells.

    1. You can concatenate the two columns on both spreadsheets directly to the left and do your match that way - I hope this comes across clear. If not, you can email me and I can send you my spreadsheet or modify yours

      spreadsheet1 spreadsheet 2
      '=VLOOKUP(J65&K65,$O$65:$R$67,4,FALSE) '=+S65&T65

      abc 10 test abc10 abc 10 test
      abcx 20 1 abcx20 abcx 20 1
      abc 30 three abc30 abc 30 three

  6. Hi,

    the value that i try to match is the combination of text,-(hyphen) and number, eg. www-f-111. I noticed that they only match the www and return a result.

    Anyway that my match criteria included text, hyphen and number?

    Thanks in advanced.

    1. Put "" around it. So use "www-f-111"

  7. REGARDING: Look up with multiple criteria using INDEX MATCH
    Your formula on 2 criteria works but to check that i understand WHY it works recreated your example in my Excel 2010 and I entered in a separate cell:

    ={(A2='Lookup table'!$A$2:$A$13)}

    expecting it to evaluate to 1 or TRUE. However it evaluates to FALSE so although your overall formula works it shouldn't? both of the tests need to evaluate to 1 for it to find a match (zero * anything is zero or FALSE?)

    Can anybody shed light on this?

    1. I am also experiencing the same thing and using Excel 2010. Could this be an Excel 2010 issue?

  8. I'm having trouble get an "and" statement to work. I have the existing formula
    =IF(ISNUMBER(SEARCH("-08",B562)),139,IF(ISNUMBER(SEARCH("-11-",B562)),139,IF(ISNUMBER(SEARCH("-15-",B562)),139,IF(ISNUMBER(SEARCH("-20-",B562)),139,IF(ISNUMBER(SEARCH("-30-",B562)),159)))))
    But I need to see if that same source cell has a "P" included. If so then the above values would apply and if the value in the source cell is "S" then a different value would apply.

    1. If I understand your task correctly, then please use the formula below:

      =IF( OR(ISNUMBER(SEARCH("-08",B562)), ISNUMBER(SEARCH("-11-",B562)), ISNUMBER(SEARCH("-15-",B562)), ISNUMBER(SEARCH("-20-",B562)), ISNUMBER(SEARCH("-30-",B562)) ), IF( ISNUMBER(SEARCH("P",B562)), 139, IF(ISNUMBER(SEARCH("S",B562)), 999, 555)), 159)

      The result will be as follows:
      139 – the cell contains at least one value from this list: "-08", "-11-", "-15-", "-20-", "-30-" AND contains "P"
      999 – the cell contains at least one value from this list: "-08", "-11-", "-15-", "-20-", "-30-" AND contains "S"
      555 – the cell contains at least one value from this list: "-08", "-11-", "-15-", "-20-", "-30-", but does not contain "S" or "P"
      159 – the cell contains nothing from this list: "-08", "-11-", "-15-", "-20-", "-30-" AND contains "P"

  9. Hi
    how can i have sorted data from large data bank in a different sheet. for example -

    Date name collection $
    1/01 A 100
    1/01 B 50
    2/01 c 200
    2/01 D 20
    02/01 A 40
    03/01 A 100... and so on...

    say this is my data sheet. now i want to make a different sheet knowing what is collection detail of A. how can i have result like following in a different sheet-

    01/01 100
    02/01 40
    03/01 100... like this.

    Please help me providing your valuable comment. Thanx in advance...

    1. Hello Rony,

      The best approach is using a pivot table. Just add the Name column to the Filters group, Date column to the Rows group, and
      "collection $" column to the Values group.

      You can find more information in our PivotTable tutorial.

  10. 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

  11. =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

    1. 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.

    2. 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)

  12. 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.

    1. Thanks got a way around :)

  13. 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!

    1. =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

  14. 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,

    1. 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

  15. 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

  16. 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

    1. 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)))

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

  17. =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.

    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.

  18. 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

    1. Thank you for this valuable piece of information, Alan!

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

    1. 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.

  20. 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.

    1. 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.

  21. 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

    1. Hello Willie,

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

  22. 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.

    1. Hello Niraj,

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

      1. 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.

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

  23. 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

    1. 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

  24. 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.

    1. 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.

    2. 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?

    3. 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

    4. 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

    5. 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.

      1. 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.

    6. 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.

    7. 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.

    8. 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.

      1. 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.

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

      3. 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

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

        1. Sumif can be use for the same

      5. 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.

        1. 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.

Post a comment



Thanks for your comment! Please note that all comments are pre-moderated, and off-topic ones may be deleted.
For faster help, please keep your question clear and concise. While we can't guarantee a reply to every question, we'll do our best to respond :)