+ Reply to Thread
Results 1 to 5 of 5

Problem: incorrect value returned using INDEX, MATCH, MIN

  1. #1
    Registered User
    Join Date
    12-24-2021
    Location
    Switzerland
    MS-Off Ver
    2016
    Posts
    2

    Problem: incorrect value returned using INDEX, MATCH, MIN

    I would be very grateful if someone could help me with what is probably a simple problem. I have attached a spreadsheet that hopefully clearly illustrates the problem. In this spreadsheet, the first column lists various categories, each of which has many entries (in this example the two columns with values are labelled "High" and "Low"). I am then trying to find the maximum value for one of these categories (in the example, "Low") in column "Pigs", which I do successfully using this formula:

    {=MAX(IF(A2:A11=A13,B2:B11))} Here the formula only looks for maximum values when the word "Low" is found in the first column

    Next, I am trying to read off the value for this row in the "Cows" COLUMN. I attempt this using the following formula:

    {=INDEX(C2:C11,MATCH(MAX(IF(A2:A11=A13,B2:B11)),B2:B11,0))}

    The problem is, that this formula establishes the value to search for (20) but then searches through all values in column "Cows", not just the values associated with "Low". Because one of the "High" category also has a value of 20, the formula returns the values of "Cows" for this, rather than the one I want. How can I get the correct value here? I need a way of telling excel to only extract the value in the "Cows" column at the exact row given by the first formula.

    Hopefully this is sufficiently clear. Many thanks for the help.
    Attached Files Attached Files

  2. #2
    Forum Guru
    Join Date
    02-27-2016
    Location
    Vietnam
    MS-Off Ver
    2024
    Posts
    6,172

    Re: Problem: incorrect value returned using INDEX, MATCH, MIN

    Change to:

    {=INDEX(C2:C11,MATCH(MAX(IF(A2:A11=A13,B2:B11)),IF(A2:A11=A13,B2:B11),0))}

  3. #3
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    25,408

    Re: Problem: incorrect value returned using INDEX, MATCH, MIN

    You can use this array* formula in B16:

    =INDEX(C2:C11,MATCH(1,(MAX(IF(A2:A11=A13,B2:B11))=B2:B11)*(A2:A11=A13),0))

    *An array formula needs to be confirmed using the key strokes Ctrl-Shift-Enter (CSE) instead of the usual Enter, unless you are using Excel 365.

    Hope this helps.

    Pete

  4. #4
    Registered User
    Join Date
    12-24-2021
    Location
    Switzerland
    MS-Off Ver
    2016
    Posts
    2

    Re: Problem: incorrect value returned using INDEX, MATCH, MIN

    Thank you both very much for this. It's working now and I can enjoy Christmas. Really appreciate the rapid help.

  5. #5
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    25,408

    Re: Problem: incorrect value returned using INDEX, MATCH, MIN

    You're welcome - glad to help.

    If that takes care of your original question, please take a moment to select Thread Tools from the menu above and to the right of your first post in this thread, and mark the thread as SOLVED.

    Also, since you are relatively new to the forum, you might like to know that you can directly thank those who have helped you by clicking on the small "star" icon located in the lower left corner of a post that you have found to be helpful (not just in this thread - for any post that has helped you). This also adds to the reputation of the poster (the small green bars in the poster's profile).

    Merry Christmas.

    Pete

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Need something like INDEX MATCH with MIN value returned
    By kwoltman in forum Excel General
    Replies: 2
    Last Post: 03-02-2021, 11:44 PM
  2. [SOLVED] INDEX & MATCH returns partially incorrect match after sorted
    By chaiyya345 in forum Excel Formulas & Functions
    Replies: 9
    Last Post: 11-16-2020, 08:50 PM
  3. [SOLVED] Problems with INDEX, MATCH, MATCH returning incorrect values
    By Paul103 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 03-03-2018, 05:16 PM
  4. [SOLVED] INDEX/MATCH generates incorrect result by referencng nearest cell if match not found
    By aglawrence in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 10-29-2017, 08:59 AM
  5. Need 0 Value Returned for NA# on Index Match Formula
    By dharrier in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 03-21-2015, 08:21 PM
  6. [SOLVED] Incorrect column number returned in INDEX, MATCH for nth instance
    By BuZZarD73 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 09-29-2014, 11:00 AM
  7. [SOLVED] Index & Match returning incorrect value. Arrays fixed and exact match used.
    By SDes in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 09-07-2012, 08:29 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1