+ Reply to Thread
Results 1 to 5 of 5

Excel 2007 : Lookup a value and return the latest date

  1. #1
    Registered User
    Join Date
    07-04-2011
    Location
    London
    MS-Off Ver
    Excel 2007
    Posts
    15

    Lookup a value and return the latest date

    Hi,

    I have a set of data which is imported from Access that contains a list of contracts.

    The contracts will relate to a product code - but there may be one or more contracts per product code.

    I would like to look up this product code and return the last contract date.

    I have tried a combination of MAX, IF, MATCH, INDEX etc., but can't seem to find the magic formula!

    Thanks,

  2. #2
    Forum Moderator zbor's Avatar
    Join Date
    02-10-2009
    Location
    Croatia
    MS-Off Ver
    365 ProPlus
    Posts
    15,592

    Re: Lookup a value and return the latest date

    can you upload example workbook?

  3. #3
    Registered User
    Join Date
    07-04-2011
    Location
    London
    MS-Off Ver
    Excel 2007
    Posts
    15

    Re: Lookup a value and return the latest date

    Zbor,

    The data effectively is as:

    Key Expiration Date
    1 01/01/2001
    1 01/01/2002
    1 01/01/2003
    2 01/01/2002
    2 01/01/2005
    2 01/01/2011
    2 01/01/2004
    2 05/05/2005
    2 05/06/2005
    3 04/05/2010
    4 05/05/2010
    5 06/06/2010
    6 30/09/2011
    7 06/12/2010
    7 12/06/2011

    So, I need to be able to lookup key=2 and return the most recent date (in this case 01/01/2011). I have done this so far just by sorting and filtering, but I am trying to set this up for people to run periodically as part of a much larger task and was hoping to have as little filtering/sorting/formatting as possible!

    Many thanks!

  4. #4
    Forum Expert sweep's Avatar
    Join Date
    04-03-2007
    Location
    Great Sankey, Warrington, UK
    MS-Off Ver
    2003 / 2007 / 2010 / 2016 / 365
    Posts
    3,443

    Re: Lookup a value and return the latest date

    Hi,

    You can do this with an array formula. Presuming your above example starts in cell A1,

    =MAX(IF(A2:A16=Key,B2:B16,""))

    confirmed with CTRL, SHIFT and ENTER, will return the highest date that for key
    Rule 1: Never merge cells
    Rule 2: See rule 1

    "Tomorrow I'm going to be famous. All I need is a tennis racket and a hat".

  5. #5
    Registered User
    Join Date
    07-04-2011
    Location
    London
    MS-Off Ver
    Excel 2007
    Posts
    15

    Re: Lookup a value and return the latest date

    Works a treat!

    Thanks Sweep!

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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