+ Reply to Thread
Results 1 to 12 of 12

Index Match with Two Criteria, Mix of Multiple Correct Rows and Greater than Rows

  1. #1
    Registered User
    Join Date
    01-31-2016
    Location
    Wiltshire
    MS-Off Ver
    2010
    Posts
    7

    Post Index Match with Two Criteria, Mix of Multiple Correct Rows and Greater than Rows

    Need help getting correct answer for the following-
    I have three columns of data:
    Column A shows several answers, multiple times
    Column B shows ascending numbers for each of the different answers in Column A
    Column C is the data I wish to return.

    I wish to get the correct answer from Column C (or the answer that is less than the match), corresponding to the correct part of column B as identified by column A.
    Example attached should make this clearer.

    I have tried all forms of index, match and if statements, but this is beyond me as keeps throwing up the wrong answer. I can set the data table up differently if this would help.

    Appreciate anyone's help with this.

    thanks
    Attached Files Attached Files
    Last edited by hochpoch; 01-31-2016 at 05:10 PM.

  2. #2
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,202

    Re: Index Match with Two Criteria, Mix of Multiple Correct Rows and Greater than Rows

    Try

    =IFERROR(INDEX($C$2:$C$16,MATCH(1,($A$2:$A$16=$F$1)*($B$2:$B$16=$F$2),0)),"")

    Enter with Ctrl+Shift+Enter

  3. #3
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: Index Match with Two Criteria, Mix of Multiple Correct Rows and Greater than Rows

    Hi,

    One way

    Formula: copy to clipboard
    Please Login or Register  to view this content.


    This returns the value for the ID where the required Rank is <= the column B rank. i.e. Type P Rank 100 returns H. If you need the next higher ID then remove the -1
    Richard Buttrey

    RIP - d. 06/10/2022

    If any of the responses have helped then please consider rating them by clicking the small star icon below the post.

  4. #4
    Registered User
    Join Date
    01-31-2016
    Location
    Wiltshire
    MS-Off Ver
    2010
    Posts
    7

    Re: Index Match with Two Criteria, Mix of Multiple Correct Rows and Greater than Rows

    Hi John,

    Thanks for your quick reply, the above works, but only if the value in F2 has an exact match in B2:B16. Is there anyway to adapt this to find the value in column B which is equal to or greater than F2?

  5. #5
    Registered User
    Join Date
    01-31-2016
    Location
    Wiltshire
    MS-Off Ver
    2010
    Posts
    7

    Re: Index Match with Two Criteria, Mix of Multiple Correct Rows and Greater than Rows

    Hi Richard,

    I can't get your formula to work - I am getting a REF!. can you please explain the H3-1 in the formula, as I don't have any data in H3?

    thank you,

  6. #6
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: Index Match with Two Criteria, Mix of Multiple Correct Rows and Greater than Rows

    Sorry, I'd use a helper cell H3 and forgot to put this formula in the solution formula. Use:

    Formula: copy to clipboard
    Please Login or Register  to view this content.


    In the production workbook I'd be inclined to create dynamic range names for A1:A16, B1:B16 and C1:C16 so that they adjust their size automatically and use the names in the formula.

  7. #7
    Registered User
    Join Date
    01-31-2016
    Location
    Wiltshire
    MS-Off Ver
    2010
    Posts
    7

    Re: Index Match with Two Criteria, Mix of Multiple Correct Rows and Greater than Rows

    Thank you so much, this is working!! I'd never have got there on my own.
    I have never created dynamic name ranges before, how do I go about this?

  8. #8
    Registered User
    Join Date
    01-31-2016
    Location
    Wiltshire
    MS-Off Ver
    2010
    Posts
    7

    Re: Index Match with Two Criteria, Mix of Multiple Correct Rows and Greater than Rows

    Hi Richard,

    while the formula worked brilliantly in the workbook sample I attached, it will not work in my master workbook.

    the main difference that I can think of is that i have 3 more columns between my sample workbook column A and column B.

    can you help explain how I can get this to work please.

    thanks

  9. #9
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: Index Match with Two Criteria, Mix of Multiple Correct Rows and Greater than Rows

    Hi,

    Have you changed the references in the original formula so that what were originally ranges B1:B16 & C1:C16 are now E1:E16 and F1:F16? And of course the original F1 & F2 will now be J1 & J2 presumably.

    As for dynamic ranges you use the Name Manager and define the name thus. Take the current A1:A16 as an example. Create a name called say "Type" and define this as

    Formula: copy to clipboard
    Please Login or Register  to view this content.


    This means with the 'anchor' cell A1 offset this by zero rows and zero columns (effectively the anchor cell is still A1, and set the height of the range named Type to be the number of cells that the COUNTA() function evaluates to, in your example this will be 16, and set the width of the range to 1 column.

    As you add new data the COUNTA() function will automatically increase its value and the named range will expand accordingly.

  10. #10
    Registered User
    Join Date
    01-31-2016
    Location
    Wiltshire
    MS-Off Ver
    2010
    Posts
    7

    Re: Index Match with Two Criteria, Mix of Multiple Correct Rows and Greater than Rows

    Hi Richard,

    Yes, I did change the references to match the new data set. I recreated the data into three rows as per the sample data and it then seemed to work, however, I have 5000 rows of data requiring solutions and it started throwing up incorrect answers part way down. Would there be a limit to how many rows your formula would work for. I did create dynamic ranges to see if this helped, but it did not.

    At the moment the only I can get this to work at the moment is by splitting the data table into separate sections with column A entries as column headings and a very long nested if statement, with index, match!

    I would like to understand why your formula didn't work, as this would be much easier in the future, so any ideas would be very welcome.

    Thanks

  11. #11
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: Index Match with Two Criteria, Mix of Multiple Correct Rows and Greater than Rows

    Hi,

    I think you'd better upload your actual workbook. The only thing I can think of is that the COUNTA() function counts cells that aren't blank and it's mostly used where we know there is a contiguous set of values in every cell between the first cell and the last row which contains a value. Maybe you have some gaps.

  12. #12
    Registered User
    Join Date
    01-31-2016
    Location
    Wiltshire
    MS-Off Ver
    2010
    Posts
    7

    Re: Index Match with Two Criteria, Mix of Multiple Correct Rows and Greater than Rows

    sorry, can't upload the actual workbook as it is a 'work' book and I'm not allowed to share the data, but I know I have some N/As in the data requiring solutions and this might be why the COUNTA() isn't working fully. I'll fix these tomorrow and then try again,

    thank you

+ 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. Replies: 10
    Last Post: 10-26-2021, 05:36 AM
  2. Help with index match with multiple rows criteria
    By parreich in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 07-10-2015, 02:52 AM
  3. Replace Index Match with VBA - Multiple Criteria - Thousands of rows and columns
    By jaybrd1 in forum Excel Programming / VBA / Macros
    Replies: 19
    Last Post: 04-30-2014, 08:39 AM
  4. VLookup or Index/match searching rows instead of columns or multiple criteria
    By Groovicles in forum Excel Formulas & Functions
    Replies: 9
    Last Post: 11-16-2013, 05:00 PM
  5. [SOLVED] Index/Match - multiple criteria & greater than!
    By kennedy.clan in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 09-15-2013, 09:03 AM
  6. [SOLVED] INDEX+MATCH with multiple criteria across both rows and columns
    By george_k in forum Excel General
    Replies: 3
    Last Post: 10-26-2012, 04:11 PM
  7. [SOLVED] Index and Match Multiple Header (Rows) Criteria
    By dluhut in forum Excel General
    Replies: 7
    Last Post: 04-12-2012, 06:25 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