+ Reply to Thread
Results 1 to 11 of 11

VLOOKUP based on Id and date range

  1. #1
    Registered User
    Join Date
    03-28-2012
    Location
    Mangalore
    MS-Off Ver
    Excel 2007
    Posts
    6

    VLOOKUP based on Id and date range

    I request you to kindly share any solution that you have for this simple looking problem. Thanks in advance.

    I have a projects master table where I have following columns:
    A: Employee Id
    B: Start Date
    C: End Date
    D: Project Name

    In another sheet I have following columns:
    A: Audit Date
    B: Emp Id
    C: Project Name

    Basically for a given Audit Date and Emp Id in sheet 2, I want to lookup and list everyone's project name on that date from sheet 1. Kindly help.

    Note: I tried to look at solutions provided in this forum so far, but none exactly seemed to match my requirement.

  2. #2
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,485

    Re: VLOOKUP based on Id and date range

    You do not have an audit date in the first sheet.
    Maybe supply a sample workbook.

  3. #3
    Registered User
    Join Date
    03-26-2012
    Location
    Australia
    MS-Off Ver
    Excel 2010
    Posts
    59

    Re: VLOOKUP based on Id and date range

    Ignoring audit date, assuming Emp ID is in cell B2 of sheet 2, then in cell c2 of sheet 2 put:

    =Vlookup(b2,sheet1!$a$1:$d$200,4,false)

    Replace d200 with whatever cell the last value in your range falls in. Sheet1 = names of your projects master table sheet.

    Based on what you have given I don't see how an Audit date is relevant to your master table.

  4. #4
    Registered User
    Join Date
    03-28-2012
    Location
    Mangalore
    MS-Off Ver
    Excel 2007
    Posts
    6

    Re: VLOOKUP based on Id and date range

    Sorry for the confusion. Here is problem statement with more clarity:

    I request you to kindly share any solution that you have for this simple looking problem. Thanks in advance.

    I have a projects master table where I have following columns:
    A: Employee Id
    B: Start Date in the project
    C: End Date in the project
    D: Project Name

    In another sheet I have following columns:
    A: Audit Date
    B: Emp Id
    C: Project Name

    Basically for a given Audit Date and Emp Id in sheet 2, I want to lookup and list everyone's project name on that date from sheet 1. So, I need to find row where audit date falls in between start/end date and emp Id should also match. Kindly help.

  5. #5
    Registered User
    Join Date
    03-28-2012
    Location
    Mangalore
    MS-Off Ver
    Excel 2007
    Posts
    6

    Re: VLOOKUP based on Id and date range

    Kindly check the sample excel file I uploaded. I am looking for a formula for desired result column.
    Attached Files Attached Files

  6. #6
    Registered User
    Join Date
    03-23-2012
    Location
    Haryana, Delhi NCR, Bangalore.
    MS-Off Ver
    Excel 2003, 2007
    Posts
    44

    Re: VLOOKUP based on Id and date range

    Hi,

    Pls check below attachment..
    Attached Files Attached Files
    Thanx & Regards,
    Naveen Pundir

  7. #7
    Registered User
    Join Date
    03-28-2012
    Location
    Mangalore
    MS-Off Ver
    Excel 2007
    Posts
    6

    Re: VLOOKUP based on Id and date range

    Quote Originally Posted by naveen4pundir View Post
    Hi,

    Pls check below attachment..
    Naveen, thanks for your time. But the attached solution by you does not match desired result. Please let me know if I am missing something.

  8. #8
    Forum Guru
    Join Date
    05-24-2011
    Location
    India
    MS-Off Ver
    Office 2021
    Posts
    2,237

    Re: VLOOKUP based on Id and date range

    Hi kshastry,

    in I2, with CTRL+SHIFT+NTER, rather than just ENTER

    =LOOKUP(REPT("z",99),IF({1,0},"Data unavailable",INDEX(D$2:D$7,MATCH(1,IF(A$2:A$7=H2,IF(G2>=B$2:B$7,IF(G2<=C$2:C$7,1))),0))))

    Then copy down.
    Regards,
    Haseeb Avarakkan

    __________________________________
    "Feedback is the breakfast of champions"

  9. #9
    Registered User
    Join Date
    03-28-2012
    Location
    Mangalore
    MS-Off Ver
    Excel 2007
    Posts
    6

    Re: VLOOKUP based on Id and date range

    Quote Originally Posted by Haseeb A View Post
    Hi kshastry,

    in I2, with CTRL+SHIFT+NTER, rather than just ENTER

    =LOOKUP(REPT("z",99),IF({1,0},"Data unavailable",INDEX(D$2:D$7,MATCH(1,IF(A$2:A$7=H2,IF(G2>=B$2:B$7,IF(G2<=C$2:C$7,1))),0))))

    Then copy down.
    Hi Haseeb, your solution worked for me. Thanks a ton. In addition, if you could kindly explain the first part, it will be great i.e. REPT("z",99),IF({1,0},

    I am wondering about significance of "z" - why z? And when would I need to change 99 to a higher number?

    Also, IF({1,0} also beats me as I am new to this level of formula writing.

    Hope I am not pushing too much. If time permits, kindly share your knowledge. Else, I will still be thankful and will try to learn this elsewhere later :-)

  10. #10
    Forum Expert icestationzbra's Avatar
    Join Date
    01-07-2004
    MS-Off Ver
    2007, 2010
    Posts
    1,421

    Re: VLOOKUP based on Id and date range

    REPT("z",99) just repeats the letter 'z' 99 times and establishes a ridiculously large string of value for the LOOKUP function to match / reference / compare against.

    as far as {1,0} is concerned, i am unclear about that - i think it means 1 = "Data unavailable", 0 = INDEX...

    LOOKUP will find the farthest value lower than 'z' repeated 99 times. you would practically never need to increase that value of 99.
    Last edited by icestationzbra; 04-10-2012 at 04:04 PM. Reason: lack of understanding of the formula...

  11. #11
    Registered User
    Join Date
    03-28-2012
    Location
    Mangalore
    MS-Off Ver
    Excel 2007
    Posts
    6

    Re: VLOOKUP based on Id and date range

    Dear all, I have slightly more complicated problem statement now. Kindly find the attachment where in the comments section I have explained the problem statement in depth.

    Kindly help as this is way beyond my expertise in excel. Thanks in advance.
    Attached Files Attached Files

+ 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