Help! Trying to pull historical employee data based on a date range.

livesmiley

New Member
Joined
Nov 1, 2019
Messages
1
I have one file (Pay Statement) with Employee numbers (column B) and pay period dates (column E). In column M I am trying to pull in data from another file (History). The History file has the employee number (column A), the effective begin date (column C), effective end date (column D) and the chosen amount (column J). I am needing to pull the historical amount that was valid at the pay period end date for that particular employee. Any help you can provide would be greatly appreciated! Thanks!
 

Excel Facts

Copy formula down without changing references
If you have =SUM(F2:F49) in F50; type Alt+' in F51 to copy =SUM(F2:F49) to F51, leaving the formula in edit mode. Change SUM to COUNT.
Hi livesmiley,

You don't say how many rows of data you have so I'm checking every row on the sheet. The formula will run faster if you limit the row range.

Here's the historical data sheet. No formulae here, just the data. I'm assuming they all have an effective end date and no date ranges overlap for an employee:

ABCDEJ
1Employee IdNameEffective Begin DateEffective End DateHistorical Amount
2A154Alf Carruthers02-Feb-1924-May-19$18,888
3B189Bert Jones21-Feb-1912-Jun-19$19,955
4B189Bert Jones13-Jun-1902-Oct-19$21,222
5C132Charlie White31-Mar-1920-Jul-19$12,487
6C132Charlie White21-Jul-1905-Oct-19$13,985
7H165Hannah Ross22-Apr-1927-Nov-19$15,664
8S396Sarah Pollard12-Apr-1916-Dec-19$17,543
9S429Stella Mitchell12-Apr-1904-Jan-20$19,649

<tbody>
</tbody>
Historical

Here's the Pay Statement with the formula:

ABCDEFM
1NameEmployee IdPay Period DateHistorical Amount
2Alf CarruthersA15403-Mar-19$18,888
3Bert JonesB18903-Aug-19$21,222
4Charlie WhiteC13206-Apr-19$12,487
5Hannah RossH16523-Apr-19$15,664
6Sarah PollardS39620-Aug-19$17,543
7Stella MitchellS42906-Sep-19$19,649

<colgroup><col style="width: 25pxpx"><col><col><col><col><col><col><col></colgroup><thead>
</thead><tbody>
</tbody>
Pay Statement

Worksheet Formulas
CellFormula
M2
copied down
=INDEX(Historical!J:J,AGGREGATE(14,6,ROW(Historical!A:A)/((B2=Historical!A:A)*(E2>=Historical!C:C)*(E2<=Historical!D:D)),1))

<thead>
</thead><tbody>
</tbody>

<tbody>
</tbody>
 
Upvote 0

Forum statistics

Threads
1,214,620
Messages
6,120,554
Members
448,970
Latest member
kennimack

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