+ Reply to Thread
Results 1 to 14 of 14

Vlookup date from multiple occurences

  1. #1
    Registered User
    Join Date
    07-23-2007
    Location
    Norfolk, England
    MS-Off Ver
    2007
    Posts
    27

    Vlookup date from multiple occurences

    Hi

    I am having trouble doing a VLOOKUP, whereby I have a column of staff that are frequently detached from the workplace (See extract sample). One member of staff could be away 4 times in a year and I need to place the most relevant detached date (which would be 2 months ago and 4 months from today) into another table. This other table would then show all members of staff in alphabetical order with just one detached and return date. If the date falls out of the above parameters (6 month window), nothing would be displayed.

    Many thanks,

    Mac
    Attached Files Attached Files
    Last edited by markmac234; 05-23-2008 at 05:27 PM.

  2. #2
    Forum Expert Ron Coderre's Avatar
    Join Date
    03-22-2005
    Location
    Boston, Massachusetts
    MS-Off Ver
    2013, 2016, O365
    Posts
    6,996

    Vlookup date from multiple occurences

    The file you attached is a good starting point for us....
    but, it would be helpful if you also showed us what values
    you're looking for in the result table.
    Ron
    Former Microsoft MVP - Excel (2006 - 2015)
    Click here to see the Forum Rules

  3. #3
    Registered User
    Join Date
    07-23-2007
    Location
    Norfolk, England
    MS-Off Ver
    2007
    Posts
    27

    Sorry - I have attached an update

    Basically, I would like to auto populate columns C:D on the 'Recent Detachments' worksheet. This worksheet has all staff members in alphabetical order, so I can see their most relevant trips away.

    Many thanks,

    Mac
    Attached Files Attached Files

  4. #4
    Forum Expert Ron Coderre's Avatar
    Join Date
    03-22-2005
    Location
    Boston, Massachusetts
    MS-Off Ver
    2013, 2016, O365
    Posts
    6,996

    Vlookup date from multiple occurences

    Well, I should have been clearer...

    It seems that every person listed has dates that are within the past two months through the next four months. Which dates do you want to see for which people? Also, if you fill in ALL of the results, that will help.

  5. #5
    Registered User
    Join Date
    07-23-2007
    Location
    Norfolk, England
    MS-Off Ver
    2007
    Posts
    27
    I have now entered detached dates from 2006-2009.

    Kind regards,

    Mac
    Attached Files Attached Files

  6. #6
    Forum Expert Ron Coderre's Avatar
    Join Date
    03-22-2005
    Location
    Boston, Massachusetts
    MS-Off Ver
    2013, 2016, O365
    Posts
    6,996

    Vlookup date from multiple occurences

    Hmmm....not the additional detail I needed.

    Using the latest file you posted....
    Today is 24-May-2008
    2 Mths ago is 24-Mar-2008
    4 Mths from now is 24-Sep-2008

    Harrison has 4 entries:
    Please Login or Register  to view this content.
    Do you want the entries that:
    Start AND end within the date range?
    Start within the date range?
    End within the date range?
    Something else?

    If there are more than one that meet the criteria,
    do you want the one that:
    Ends latest?
    Begins latest?
    Something else?

  7. #7
    Registered User
    Join Date
    07-23-2007
    Location
    Norfolk, England
    MS-Off Ver
    2007
    Posts
    27
    Ron

    I would like the criteria to be the start date falling in the 6 month window. If that person does not have a date that matches this window, then nothing will be displayed. Basically, I need to keep a track of those members of staff who have recently departed (i.e. 2 months ago), are still away and those who will be departing in the next 4 months; this is the 6 month window that I need to track for each person.

    Regards,

    Mac

  8. #8
    Forum Contributor
    Join Date
    08-21-2006
    Location
    Ossett, West Yorkshire
    MS-Off Ver
    2003
    Posts
    150

    Smile

    Hi, I hope I have got the right end of the stick! in the attached file I've assumed that 2 months is 60 days and that 4 months is 120 days both can be changed to suit whatever period that you want.
    Hope this helps. Regards Howard
    Attached Files Attached Files

  9. #9
    Registered User
    Join Date
    07-23-2007
    Location
    Norfolk, England
    MS-Off Ver
    2007
    Posts
    27
    Howard,

    Many thanks for the updated workbook, and whilst your formula does return the values I am after, the 17 names in the 'Recent detachments' worksheet must remain static. I have slightly altered the attachment to explain this.

    Regards,

    Mac
    Attached Files Attached Files

  10. #10
    Forum Contributor
    Join Date
    08-21-2006
    Location
    Ossett, West Yorkshire
    MS-Off Ver
    2003
    Posts
    150

    Smile

    Hi Mac, I had to take a liberty in inserting an extra column in the 'all detachment' sheet so I could enter the formula for the Vlookup to pick up the staff numbers,that come into your criteria of dates, this can be of course be hidden.
    Regards Howard
    Attached Files Attached Files

  11. #11
    Registered User
    Join Date
    07-23-2007
    Location
    Norfolk, England
    MS-Off Ver
    2007
    Posts
    27

    Smile

    Howard,

    You are an absolute star!! This is FINALLY what I have been looking for. I would never in a million years have thought of placing IF and AND staements to the leftmost Vlookup column. Many many thanks to you.

    Kind regards,

    Mac

  12. #12
    Forum Contributor VBA Noob's Avatar
    Join Date
    04-25-2006
    Location
    London, England
    MS-Off Ver
    xl03 & xl 07(Jan 09)
    Posts
    11,988
    markmac234,

    Please read forum rules below and then add the link to the other forum where you have cross posted this question

    VBA Noob
    _________________________________________


    Credo Elvem ipsum etian vivere
    _________________________________________
    A message for cross posters

    Please remember to wrap code.

    Forum Rules

    Please add to your signature if you found this link helpful. Excel links !!!

  13. #13
    Forum Contributor
    Join Date
    08-21-2006
    Location
    Ossett, West Yorkshire
    MS-Off Ver
    2003
    Posts
    150

    Smile

    Hi Mac,
    Many thanks for the feedback glad to be of help
    Regards Howard

  14. #14
    Registered User
    Join Date
    07-23-2007
    Location
    Norfolk, England
    MS-Off Ver
    2007
    Posts
    27
    http://www.excelforum.com/showthread.php?t=644665

    This is a similar problem that I had, and although it was resolved, the solution on this page is perfect for my workbook. Thanks again to Howard.

    Regards,

    Mac


+ 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