+ Reply to Thread
Results 1 to 6 of 6

Vlookup 2 Criteria

  1. #1
    Registered User
    Join Date
    12-29-2008
    Location
    united, states
    MS-Off Ver
    Excel 2003
    Posts
    18

    Vlookup 2 Criteria

    I am not sure if a vlookup will do the trick but it’s on the right track.
    I have a spreadsheet with 2 workbooks, one is data imported from sap and the other is a manually created spreadsheet received by email. Both have corresponding data, id number, date. The SAP data has a column for number of hours. I need to pull up the number of hours where the date and the ID are the same.

    Say for example
    Worksheet a
    A b c
    Date ID Reg hours
    01/01/2010 4 5.25
    01/04/2010 4 8.25
    01/05/2010 4 8.25



    Worksheet b
    A b c d
    Date ID SickTime Reg Hours
    01/01/2010 4 3


    As you can see I would need worksheet “B” to look up “Reg Hours” based in the matching data in worksheet “A”. Would anyone be able to offer a suggestions?

  2. #2
    Forum Expert
    Join Date
    01-12-2007
    Location
    New Jersey
    Posts
    2,127

    Re: Vlookup 2 Criteria

    I believe the SUMPRODUCT formula is the best for this application.

    Modify the following formula to suit:

    Please Login or Register  to view this content.
    As a reference, the "A2:A5" represents the date column in the main database that you are querying (worksheet A). The "F2" represents the date cell in Worksheet B. "B2:B5" represents the ID field in Worksheet A, and G2 represents the employee ID in Worksheet B. Finally, "C2:C5" represents the employee hours column in Worksheet A. Let me know if you were able to adapt this.

  3. #3
    Forum Contributor
    Join Date
    07-24-2008
    Location
    Athome
    MS-Off Ver
    Excel 2013
    Posts
    127

    Re: Vlookup 2 Criteria

    just to confirm - the ID is only used once on each date?
    If so, then the Sumproduct will work fine. If not, then you'll need another identifier to distinguish the unique entries but a sumproduct formlua will still be the one to use.

  4. #4
    Registered User
    Join Date
    12-29-2008
    Location
    united, states
    MS-Off Ver
    Excel 2003
    Posts
    18

    Re: Vlookup 2 Criteria

    the id is the employee id, which will have several dates for each ID. its an employee time clock log.
    so on worksheet b, each date will only have 1 date, but on worksheet a the ID's will many dates.

  5. #5
    Registered User
    Join Date
    12-29-2008
    Location
    united, states
    MS-Off Ver
    Excel 2003
    Posts
    18

    Re: Vlookup 2 Criteria

    it works by the way, if there are additional dates for the id they just add up.

    what if i added a 3rd criteria where there was a column in worksheet a that was for type, and i wanted to only produce the values that equal "Reg"?

  6. #6
    Forum Expert teylyn's Avatar
    Join Date
    10-28-2008
    Location
    New Zealand
    MS-Off Ver
    Excel 365 Insider Fast
    Posts
    11,372

    Re: Vlookup 2 Criteria

    then just add another condition to the sumproduct

    =SUMPRODUCT(--(A2:A5=F2),--(B2:B5=G2),--(E2:E5="reg"),C2:C5)

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

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