+ Reply to Thread
Results 1 to 7 of 7

VLookup - find highest Value...

  1. #1
    Registered User
    Join Date
    06-17-2008
    MS-Off Ver
    Excel 2003
    Posts
    30

    VLookup - find highest Value...

    Hi All, I was hoping someone could help me out with this one. I'm not sure that a form of Vlookup would be correct or not but here it goes...

    I'm using a vlookup of account numbers to find a date. Problem is, some account numbers have multiple dates, so there are multiple entries. Right now, my Vlookup will pick up the first date in the list, but I need it to pick up the most recent date. Any ideas?

    For example
    Account Date
    1001 1/2/2008
    2001 1/5/2008
    3001 1/7/2008
    2001 1/9/2008
    2001 1/12/2008
    4001 1/23/2008

    so if I lookup account number 2001, it will return 1/5/2008 but I want it to return 1/12/2008.

    Thanks in advance,

    Jason

  2. #2
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898
    Assuming dates are entered in ascending order... i.e every date entry for the account number gets later

    Try:

    =MAX(IF($A$1:$A$10=X1,$B$1:$B$10))

    Where X1 contains the lookup account number and A1:B10 is your lookup table.

    This formula is an array formula and must be confirmed with CTRL+SHIFT+ENTER not just ENTER. You will see { } brackets appear
    Where there is a will there are many ways.

    If you are happy with the results, please add to the contributor's reputation by clicking the reputation icon (star icon) below left corner

    Please also mark the thread as Solved once it is solved. Check the FAQ's to see how.

  3. #3
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898
    Assuming dates are entered in ascending order... i.e every date entry for the account number gets later

    Try:

    =MAX(IF($A$1:$A$10=X1,$B$1:$B$10))

    Where X1 contains the lookup account number and A1:B10 is your lookup table.

    This formula is an array formula and must be confirmed with CTRL+SHIFT+ENTER not just ENTER. You will see { } brackets appear

  4. #4
    Registered User
    Join Date
    06-17-2008
    MS-Off Ver
    Excel 2003
    Posts
    30
    thanks - is there anyway this can be done without an array formula? I have many rows of data and these type of formula tend to really slow down my spreadsheets.

    Thanks again for your quick reply.

  5. #5
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898
    Not sure how much faster, if at all, but this is an non-array entered formula:

    =LOOKUP(2,1/($A$1:$A$10=X1),$B$1:$B$10)

    This finds the last entry in the column that matches X1 and returns corresponding item from B1:B10

  6. #6
    Registered User
    Join Date
    06-17-2008
    MS-Off Ver
    Excel 2003
    Posts
    30

    Red face

    thanks again - very helpful. Hope you don't mind my persistence but promise this will be my last question... often time my data will get filtered and sorted, so the last entry is not neccessarily the most recent date. I suppose I could filter every time so that this will work, but is there a way to modify the non array formula so it will return the Max date (or the most recent) instead of the last date in the list?

    Jason

  7. #7
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898
    Try:

    =MAX(INDEX(($A$1:$A$10=X1)*($B1:$B$10),0))

+ 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