user6906550
user6906550

Reputation:

Excel lookup 2 Values

I'm sorry if this is an obvious question, but I've been searching and can't seem to figure this out..

Cost TableCost Table
Employee    Date      Hours
2           03/16/16    8
2           03/17/16    8
2           03/20/16    8
3           03/21/16    8
3           03/22/16    8
5           03/23/16    10
6           03/24/16    4
6           03/28/16    5

Time Clock Table
Employee    Date      Hours
2           03/16/16    1
2           03/17/16    3
2           03/20/16    2
3           03/21/16    5
3           03/22/16    4
5           03/23/16    7
6           03/24/16    7
6           03/28/16    7

I just want to lookup on this table to see how many hours each employee worked on a certain date. They are cheating the system and we need to find out who's short.

Upvotes: 0

Views: 88

Answers (3)

teylyn
teylyn

Reputation: 35915

You can use a formula like this

=INDEX(TableCostTable[Hours],MATCH([@Employee]&[@Date],INDEX(TableCostTable[Employee]&TableCostTable[Date],0),0))

It concatenates the name and the date and uses Index/Match to look up the same combination and returns the hours. The formula uses structured references with the column names and header names. It will also work if you use sheet names and cell references, but don't use it with whole columns, because that will be very slow.

enter image description here

Upvotes: 1

Ben Smith
Ben Smith

Reputation: 819

You can solve this through a SUMIFS formula, such as:

=SUMIFS(C:C, A:A, 2, B:B, "03/07/16")

What this is doing is summing all values in column C where column A is equal to 2 (for the employee) where column B is equal to 03/07/16.

Upvotes: 0

nutsch
nutsch

Reputation: 5962

You need a SUMIFS rather than a VLOOKUP, in this case

=sumifs(Paytable!C:C, Paytable!A:A,2,Paytable!B:B,date(2016,3,17))

Upvotes: 0

Related Questions