Look up date and amount of last wage increase

megera716

Board Regular
Joined
Jan 3, 2013
Messages
146
Office Version
  1. 365
Platform
  1. Windows
I have a table of employees, their current wage and their historical wage with effective date. Our payroll system is....not great (for a multitude of reasons, which is why we're replacing it) and cannot report just the difference between their current wage and prior wage, so I know how much their last raise was.

I'm preparing raise budgets and I've got the most recent value for each employee (their current wage). I'm trying to look up each EE and return the wage they were at before their current one ("next-most recent") to find the difference between the two and the date of that raise.

See below for some anonymized data. I don't know why "Mickey" shows all these compensation "changes" when the rate isn't actually changing -- it's been $25/hour for the last 3 records (maybe there was some other variable that did change) -- but in Mickey's case, I'd want to return $3/hour (the difference between $22 and $25) and the date 1/1/2022, ignoring the 11/26/22. Daisy is pretty normal -- each date actually does show a change, but Minnie has not had a change at all (probably too new), so hers should return $0/"no change".

I sorted them in reverse chronological order but I can change that if needed.
1692047260577.png
 

Excel Facts

How to show all formulas in Excel?
Press Ctrl+` to show all formulas. Press it again to toggle back to numbers. The grave accent is often under the tilde on US keyboards.
I suggest that you update your Account details (or click your user name at the top right of the forum) so helpers always know what Excel version(s) & platform(s) you are using as the best solution often varies by version. (Don’t forget to scroll down & ‘Save’). Recent version of Excel have some functions that would make this pretty easy, using the MAXIFS function.

See: MAXIFS function - Microsoft Support
 
Upvote 0
Thank you @Joe4 ! I thought I did have that info on my profile but I have updated it to reflect that I am using 365 :).

I haven't used MAXIFS before but I read the article you linked. It seems like this would be useful for returning the most recent date and/or wage but I'm trying to return the one before that.

And I don't even know if what I'm looking for CAN be done but I have hundreds of employees to do this for so the idea of doing the math one by one is....not really feasible. And if anyone would know how to do it, it would be the amazing folks here 😁, who have helped me countless times (through my own posts or what I've gleaned from others and applied to my situation).
 
Upvote 0
In your example, the rates always seem to be increasing over time, as one would expect.
If that always is true, then you could use a nested MAXIFS, where you add a second condition, where we exclude the max date, and take the max of what is left.

So here is a simple example:
1692057973093.png


The formula in G2 is:
Excel Formula:
=MAXIFS(C$2:C$8,A$2:A$8,F2,B$2:B$8,"<>"&MAXIFS(B$2:B$8,A$2:A$8,F2))
 
Upvote 0
How about
Excel Formula:
=TOROW(TAKE(UNIQUE(FILTER(C2:C1000,A2:A1000=F2)),2))
 
Upvote 0

Forum statistics

Threads
1,223,908
Messages
6,175,306
Members
452,633
Latest member
DougMo

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