Lookup based on Date Range - Multiple Lines per Lookup_Value

smas_tx

New Member
Joined
Mar 4, 2013
Messages
9
Hi All,

I'm trying to pull employee rates into an hour report - the hour report is by day, however, the rate table is summarized into date ranges with multiple lines per employee.

I'm hoping there is a way to do this without having to rearrange the rate table format - see below, thanks in advance for your time.

Sample date set

Rate table ->

Emp #Beg DateEnd DateRate
12301/27/1106/26/1125.00
12306/27/1109/03/1226.00
12309/04/1208/15/1527.00
12308/16/1512/31/9928.00
23101/31/0704/01/0715.00
23104/02/0703/31/1117.00
23104/01/1105/16/1120.00
23105/17/1109/03/1225.00
32110/31/0512/18/0519.00
32112/19/0507/16/0617.00
32107/17/0609/17/0618.00
32109/18/0602/04/0719.00

<colgroup><col><col><col><col></colgroup><tbody>
</tbody>

Hour Report ->

Emp #Date Worked Rate?Hours Worked
12306/26/11 5.00
12309/03/12 10.00
12308/15/15 10.00
12312/31/99 10.00
23104/01/07 10.00
23103/31/11 10.00
23105/16/11 8.00
23109/03/12 10.00
32112/18/05 10.00
32107/16/06 8.00
32109/17/06 10.00
32102/04/07 5.00

<colgroup><col><col><col><col></colgroup><tbody>
</tbody>

If there isn't a way to do it with the format as is, what about a slick way to convert the rate table to this format without doing it manually?

Emp #Beg Date 1End Date 1Rate 1 Beg Date 2End Date 2Rate 2Beg Date 3End Date 3Rate 3Beg Date 4End Date 4Rate 4
12301/27/1106/26/1125.0006/27/1109/03/1226.0009/04/1208/15/1527.0008/16/1512/31/9927.00

<colgroup><col><col><col><col><col span="9"></colgroup><tbody>
</tbody>

Any input would be greatly appreciated, thanks.
 

Excel Facts

What is the last column in Excel?
Excel columns run from A to Z, AA to AZ, AAA to XFD. The last column is XFD.
Okay, here it is. You need an index–match formula with nested if-statements entered as an array formula.

=INDEX( Rate Table, MATCH(1, IF( Emp # on Hour Report = Emp # column on Rate Table, IF( Date Worked >= Beg Date column, IF( Date Worked <= End Date column, 1))), 0), COLUMN( Rate column on Rate Table )

To enter the formula as an array formula, press Ctrl + Shift + Enter.

Incidentally, this will reveal an error in the data in the Rate Table—for Emp # 123 with a Beg Date of 8/16/15, the End Date is 99. Unless this is to mean 2099, something is amiss.
 
Upvote 0
Wow! That is freaking awesome! Saved me a lot of time and introduced me to a whole new level of excel wizardry. Thank you!

And yea, that is actually 9999, our HR dept plugs it in as an open ended date - didn't notice it when I copied the 'end dates' over for the work day in the sample data set.

Anyways, thank you again! Take it easy!
 
Upvote 0

Forum statistics

Threads
1,216,119
Messages
6,128,946
Members
449,480
Latest member
yesitisasport

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top