Looking up and applying effective dates based on a working date per person

dv8123456789

New Member
Joined
Sep 26, 2017
Messages
5
Hi - I have a tab within excel that is an assignment list which details people and effective dates\rates. There are multiple people and one person may have more than one line if their rate changes mid year.

I then have a tab containing timesheet data for various people and I want to be able to look up for a particular person based on the date worked what the rate should be so I can calculate the cost.

I have seen vlookups with a true condition that fit within a range, but I cannot see how this will work given that I need it to effectively filter by person before doing the range lookup. I'm thinking perhaps sumifs of the rate if the person in the timesheet data =person in the rates table and the effective date is less than the date worked, but that could still apply to multiple rate lines so I need to narrow it down further ideally by finding the right person and then max of the effective date that is still earlier than the time date worked. Any ideas? Any help would be greatly appreciated :)
 

Excel Facts

Shade all formula cells
To shade all formula cells: Home, Find & Select, Formulas to select all formulas. Then apply a light fill color.
Assuming dates are ascending on the rate table then something like this:


Book1
ABCDEF
1PersonDateRatePersonDiane
2Alice01/01/201710Date12/05/2017
3Bob01/01/201711Rate20
4Charlie01/01/201712
5Diane01/01/201713
6Alice01/02/201714
7Bob01/02/201715
8Charlie01/02/201716
9Charlie01/03/201717
10Bob01/04/201718
11Alice01/05/201719
12Diane01/05/201720
Sheet1
Cell Formulas
RangeFormula
F3{=INDEX($C$2:$C$12,MAX(IF($A$2:$A$12=$F$1,IF($B$2:$B$12<=$F$2,ROW($B$2:$B$12)-ROW($B$2)+1))))}
Press CTRL+SHIFT+ENTER to enter array formulas.


WBD
 
Upvote 0
thanks for your reply WBD! It seems to work for a single cell but I'm struggling to auto populate multiple cells (sorry, not that familiar with arrays). Using your example, I've populated some dummy data in columns H,I and J and amended formula to {=INDEX($C$2:$C$12,MAX(IF($A$2:$A$12=$H1,IF($B$2:$B$12<=$I2,ROW($B$2:$B$12)-ROW($B$2)+1))))} so that its not a fixed reference but will change depending on the row

J2 calculates correctly the rate of 10, but I'd expect a rate change in J3 and the subsequent cells, but I'm not getting that. Do you know why please? Slightly separate question. If I wanted to return a text string instead of a rate that was applicable at a point in time using the same logic would this work do you think? Thanks again :)

ABCDEFGHIJ
1PersonDateRate PersonAlice PersonDateRate
2Alice01/01/201710 Date03/02/2017Alice31/01/201710
3Bob01/01/201711 Rate11Alice01/02/201710
4Charlie01/01/201712 Alice02/02/201710
5Diane01/01/201713 alice03/02/201710
6Alice01/02/201714
7Bob01/02/201715
8Charlie01/02/201716
9Charlie01/03/201717
10Bob01/04/201718
11Alice01/05/201719
12Diane01/05/201720

<tbody>
</tbody><colgroup><col span="2"><col span="2"><col span="2"><col><col span="2"><col><col></colgroup>
 
Upvote 0

Book1
ABCDEFGHIJ
1PersonDateRatePersonDateRate
2Alice01/01/201710Alice31/01/201710
3Bob01/01/201711Alice01/02/201714
4Charlie01/01/201712Alice02/02/201714
5Diane01/01/201713Alice03/02/201714
6Alice01/02/201714
7Bob01/02/201715
8Charlie01/02/201716
9Charlie01/03/201717
10Bob01/04/201718
11Alice01/05/201719
12Diane01/05/201720
Sheet1
Cell Formulas
RangeFormula
J2{=INDEX($C$2:$C$12,MAX(IF($A$2:$A$12=$H2,IF($B$2:$B$12<=$I2,ROW($B$2:$B$12)-ROW($B$2)+1))))}
Press CTRL+SHIFT+ENTER to enter array formulas.


WBD
 
Upvote 0
Thanks for your reply. Hopefully almost there. It might (definitely) just be a lack of understanding on my part, but I can't seem to get it to work. From doing a bit of research on array formulas I'm highlighting J2:J5, putting in the formula (minus the {}) and then hitting CTRL+SHIFT+ENTER, which gives me the {}. I get the same result (10) across all cells in J2 through J5? Do you know why this might be?
 
Upvote 0

Forum statistics

Threads
1,215,613
Messages
6,125,834
Members
449,266
Latest member
davinroach

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