+ Reply to Thread
Results 1 to 7 of 7

Vlookup to find most recent row with a criteria.

  1. #1
    Registered User
    Join Date
    09-05-2008
    Location
    DFW, Texas
    Posts
    3

    Vlookup to find most recent row with a criteria.

    Hi all, I have a table that looks like the following:

    Date Name Title Previous $ New $
    6/20/2007 John A Analyst 1 $40,000 $40,000
    7/28/2007 Mary R. Analyst 1 $42,000 $42,000
    1/15/2008 Jamie G. Manager $65,000 $75,000
    5/15/2008 John A. Analyst 2 $40,000 $50,000


    Basically, it's a chronological (it will remain sorted, most recent at bottom) listing of all changes in employee pay within a department. So it allows management to track changes in titles, raises, etc.

    I've received a request to view this data as "show me every employee's current status", which boils down to "return one line for each employee, and make sure it has the most recent date."

    I started trying to do this with VLOOKUP, and I can find the overall most recent entry with no problem. However, I can't get it to return the most recent entry for "John A."

    Any ideas?

    Thanks!
    Matt
    Last edited by mlamb2005; 09-05-2008 at 04:09 PM.

  2. #2
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678
    Welcome to the forum.

    Why not sort descending by date, so the most recent data is on top? Then VLOOKUP will return the most recent data.

    If you have to have it sorted ascending, you can use INDEX/MATCH.

  3. #3
    Registered User
    Join Date
    09-05-2008
    Location
    DFW, Texas
    Posts
    3
    Hi there, thanks for the reply.

    I think an expanded data set would make a better example, but it's not as simple as finding the most recent overall. Approximately 8 employees will have entries in the table, and I need to get exactly 8 lines, the most recent entry for each employee.

    Since raises occur at random dates, it isn't precise to say that the 8 most recent entries will necessarily relate to the 8 employees at a 1-1 relationship.

    If there is some way to do this with VLOOKUP, I'm overlooking it.

    Thanks again.

    Matt

  4. #4
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678
    VLOOKUP(name, list, column, false) will return the result for the first match for the employee, which will be the most recent if the list is sorted descending by date, irrespective of the length of the list or how many times the names appear.

    If you want to retrieve the date with a VLOOKUP as well, then move the names to the left-most column. Or, you can use an INDEX/MATCH formula to retrieve the date.

    If the list must remain as-is, then you'd use INDEX/MATCH for everything.

  5. #5
    Forum Expert
    Join Date
    11-27-2007
    Location
    New Jersey, USA
    MS-Off Ver
    2013
    Posts
    1,669

    get latest data with vlookup

    take a look at attached example.
    does it help?
    modytrane
    Attached Files Attached Files

  6. #6
    Registered User
    Join Date
    09-05-2008
    Location
    DFW, Texas
    Posts
    3
    Perfect, that example was a huge help! I swapped columns A and B and everything worked great.

    Thanks!

    Matt

  7. #7
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678
    Good job, well done.

+ 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. Find a ref in a tab then Vlookup (maybe) to find a value
    By AK262007 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 03-18-2008, 12:02 PM
  2. VLookup with Multiple Criteria
    By Exodio in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 07-23-2007, 04:28 PM
  3. COL_INDEX_NUM fixed in VLOOKUP in Excel 2007
    By zapponem in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 05-25-2007, 04:51 AM
  4. Vlookup for multiple criteria
    By ritz in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 04-05-2007, 05:30 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