A family of Microsoft spreadsheet software with tools for analyzing, charting, and communicating data.
Looking at Sheet3 I noted: (1) there will be only one row for a specified empid in A and "dental" in B, and (2) you want the date and this is a numerical values. This means we can use (misuse ?) SUMRPDUCT. Here is my Sheet1 --- I only worked on columns D and E
| empid | code | union/non | medical | dental |
|---|---|---|---|---|
| 28000546 | wk#2 | wk#2 | 01/01/2011 | 01/02/2011 |
| 28001169 | wk#2 | wk#2 | 01/04/2011 | 01/06/2011 |
| 28036852 | wk#2 | wk#2 | 01/07/2011 | 00/01/1900 |
My formula in D2 is shown below. The $s allow me to copy this across and down. Of course the ranges like A1:A9 will need to be expanded since you have more data. Also I leave it to you wrap the formula within an IF to cover the case then no match is found ( as it stands you will get 1/1/1900 , i.e zero)
=SUMPRODUCT(--(Sheet3!$A$1:$A$9=Sheet1!$A2),--(Sheet3!$B$1:$B$9=Sheet1!D$1),Sheet3!$D$1:$D$9)
best wishes
Bernard Liengme, Nova Scotia, Canada http://people.stfx.ca/bliengme/