+ Reply to Thread
Results 1 to 9 of 9

Index match multiple criteria based on earliest date

  1. #1
    Registered User
    Join Date
    03-31-2012
    Location
    London, England
    MS-Off Ver
    Excel 2010
    Posts
    84

    Index match multiple criteria based on earliest date

    Despite labouring over Contextures Index/match for multiple criteria blog, I remain unable to find a solution.

    My data set looks like this

    Column A: Dates
    Column B: Country
    Column H: Value

    I want to find the earliest date for a particular country which contains a corresponding value above zero in column H.

    Help very much appreciated.

  2. #2
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,926

    Re: Index match multiple criteria based on earliest date

    Hard to be more precise than this without seeing any sample data, but try using this ARRAY formula...
    ={MAX(IF(B2:B7="Country name",A2:A7,0))}
    ...confirmed by pressing CTRL+SHIFT+ENTER to activate the array, not just ENTER. You will know the array is active when you see curly braces { } appear around your formula. If you do not CTRL+SHIFT+ENTER you will get an error or a clearly incorrect answer. Press F2 on that cell and try again.
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

  3. #3
    Registered User
    Join Date
    03-31-2012
    Location
    London, England
    MS-Off Ver
    Excel 2010
    Posts
    84

    Re: Index match multiple criteria based on earliest date

    Thanks FDibbins but I didn't output the date I was looking for.

    The formula needs to output the earliest date for a particular country which has a value in column H.

    It's probably easier if attach an excerpt of the data set with desired formula output indicated. Hope that helps.

    Earliest date for country.xlsx

  4. #4
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,926

    Re: Index match multiple criteria based on earliest date

    Thanks for the file, makes thinks a lot easier

    Try this ARRAY formula in E12, copied down...
    =MAX(IF($B$2:$B$7=D12,IF($H$2:$H$7>0,$A$2:$A$7,0)))
    ...confirmed by pressing CTRL+SHIFT+ENTER to activate the array, not just ENTER. You will know the array is active when you see curly braces { } appear around your formula. If you do not CTRL+SHIFT+ENTER you will get an error or a clearly incorrect answer. Press F2 on that cell and try again.

  5. #5
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: Index match multiple criteria based on earliest date

    shouldnt that be min ?
    = MIN( IF( ($B$2:$B$10=D12)*($H$2:$H$10>0), $A$2:$A$10 ) ) again array entered
    "Unless otherwise stated all my comments are directed at OP"

    Mojito connoisseur and now happily retired
    where does code go ?
    look here
    how to insert code

    how to enter array formula

    why use -- in sumproduct
    recommended reading
    wiki Mojito

    how to say no convincingly

    most important thing you need
    Martin Wilson: SPV
    and RSMBC

  6. #6
    Registered User
    Join Date
    03-31-2012
    Location
    London, England
    MS-Off Ver
    Excel 2010
    Posts
    84

    Re: Index match multiple criteria based on earliest date

    Not quite working Doesn't the max function seek the latest date, rather than the earliest? I tried changing to MIN and that gave the correct output except Austrailia which should be the 8-Jun....

  7. #7
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: Index match multiple criteria based on earliest date

    did you not read post #5

  8. #8
    Registered User
    Join Date
    03-31-2012
    Location
    London, England
    MS-Off Ver
    Excel 2010
    Posts
    84

    Re: Index match multiple criteria based on earliest date

    Martin - that one works!

    Thank you both for your help. Consider it solved

  9. #9
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,926

    Re: Index match multiple criteria based on earliest date

    oops sorry, thanks for the catch Martin

    Happy to help and thanks for the feedback

+ 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. [SOLVED] INDEX MATCH based on 5 criteria, including a date range.
    By Folshot in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 11-05-2013, 09:35 PM
  2. [SOLVED] Index/Match based on multiple criteria
    By BB1972 in forum Excel General
    Replies: 7
    Last Post: 08-17-2012, 11:45 AM
  3. Replies: 3
    Last Post: 01-10-2011, 06:14 PM
  4. Find earliest date based on certain criteria
    By SeanKosmann in forum Excel Formulas & Functions
    Replies: 16
    Last Post: 01-26-2010, 11:32 AM
  5. Index and Match Based on Multiple Criteria
    By duranbeaz in forum Excel General
    Replies: 2
    Last Post: 05-22-2009, 04:37 AM

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