+ Reply to Thread
Results 1 to 5 of 5

Vlookup ID and Return Data if Date Falls Within Range

  1. #1
    Registered User
    Join Date
    01-16-2015
    Location
    Houston, TX
    MS-Off Ver
    2010
    Posts
    16

    Vlookup ID and Return Data if Date Falls Within Range

    Hello,

    I have Tab A with Employee IDs [a], Start Date [b], End Date [c], Location [d]. Employee's appear multiple times with different start and end dates and location may vary or stay the same. On Tab B I have Employee ID [a], Start Date [b], End Date [c], Salary [d]. And the same rule applies as Tab A, they may appear multiple times with the Start & End Dates and salary my change or stay the same.

    I would like a formula or VBA that searches for the ID in A2 from the array TAB b a2:d4, finds the row where the date falls within the start & end date on Tab a, and returns the salary.

    Tab A

    ID | START | END | LOCATION | SALARY
    1234 | 01/01/2014 | 06/16/2014 | DENVER | 50,000
    1234 | 06/17/2014 | 09/30/2014 | ASPEN | 53,000
    1234 | 10/01/2014 | 12/31/2014 | ASPEN | 53,000
    3456 | 01/01/2014 | 12/31/2014 | ASPEN | 20,000

    Tab B

    ID | START | END | SALARY
    1234 | 01/01/2014 | 06/16/2014 | 50,000
    1234 | 06/17/2014 | 12/31/2014 | 53,000
    3456 | 03/01/2014 | 12/31/2014 | 20,000


    Thanks!

  2. #2
    Registered User
    Join Date
    06-17-2009
    Location
    Canada
    MS-Off Ver
    Office 2010
    Posts
    84

    Re: Vlookup ID and Return Data if Date Falls Within Range

    Start with this. You will need to adjust for your purposes.

    VLookup should work for you. Might give a good starting point

    =VLOOKUP(A2,'Tab B'!A2:D4,4)

  3. #3
    Registered User
    Join Date
    06-17-2009
    Location
    Canada
    MS-Off Ver
    Office 2010
    Posts
    84

    Re: Vlookup ID and Return Data if Date Falls Within Range

    Sorry had misread your post. I have used the following and seems to work.
    =SUMPRODUCT(--(Sheet2!B1:B4>=B3), --(Sheet2!C1:C4<=C3), --(ISNUMBER(MATCH(Sheet2!A1:A4, A3,0))), Sheet2!E1:E4)

  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,933

    Re: Vlookup ID and Return Data if Date Falls Within Range

    the SP in post 3 doesnt work for row 4 (the 3rd ID 1234)

    This seems to work for what you want...
    =SUMPRODUCT((Sheet3!$A$2:$A$4=A2)*(Sheet3!$B$2:$B$4<=B2)*(Sheet3!$C$2:$C$4>=C2)*(Sheet3!$D$2:$D$4))

    However, this does not (correctly) pull in 20 000 for 3456, because teh start date was before the sheet3 start date - if you change the start date to 4/1/2014, then it pulls in the correct amount
    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

  5. #5
    Registered User
    Join Date
    01-16-2015
    Location
    Houston, TX
    MS-Off Ver
    2010
    Posts
    16

    Re: Vlookup ID and Return Data if Date Falls Within Range

    LOOKUP HELP.xlsxFDibbins, could you load your suggested formula in this worksheet please.

+ 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. Search date range +/- 7 days and return date that falls within range
    By tlafferty in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 07-13-2013, 03:26 PM
  2. [SOLVED] Return cell value if date falls within specified range
    By coza in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 06-10-2013, 03:58 PM
  3. Replies: 15
    Last Post: 04-08-2013, 12:40 PM
  4. VLOOKUP to return when the cell reference falls between a range
    By tomdenners in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 03-15-2013, 08:33 AM
  5. Return a specified date when it falls within a range....
    By Nokose451 in forum Excel General
    Replies: 1
    Last Post: 01-16-2006, 06:10 PM

Tags for this Thread

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