BBlu
asked on
Fastest way to get most recent salary
I have a table with records (rows) that contain the following fields (columns):
Employee Name
Salary change
Change date
The table lists a new record for an employee whenever his/her salary changes.
I'm trying to get the salary (e.g. column b) for the most recent (max) date of each employee. once I have list with only the unique values for the employees, how would I get the salary figure?
I think I would use an array formula, but I'm stuck.
Employee Name
Salary change
Change date
The table lists a new record for an employee whenever his/her salary changes.
I'm trying to get the salary (e.g. column b) for the most recent (max) date of each employee. once I have list with only the unique values for the employees, how would I get the salary figure?
I think I would use an array formula, but I'm stuck.
ASKER
Oh, I had the max and if functions backwards. This works now:
=MAX(IF('Salary History'!A2:A10000=2678,'S alary History'!H2:H10000,""))
Now, unless someone has a better idea, I need to figure out how to return which row this maximum (most recent) date is, so I can obtain the other information needed from other columns on that same row. I was thinking I'd use the index function for this.
=MAX(IF('Salary History'!A2:A10000=2678,'S
Now, unless someone has a better idea, I need to figure out how to return which row this maximum (most recent) date is, so I can obtain the other information needed from other columns on that same row. I was thinking I'd use the index function for this.
ASKER
I think I got it, actually. I did not even know you could do array formulas that involved both concatenation and match: WOW!
=MATCH(EmployeeName&F3,'Sa lary History'!B1:B26&'Salary History'!H1:H26,0)
=MATCH(EmployeeName&F3,'Sa
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
The LOOKUP approach allows for the possibility that a salary might go down (reduction in hours, for example). It also does not involve a time-consuming concatenation of two constraints.
ASKER
Can you explain what the "1E +40" part is?
The LOOKUP function assumes that the values are sorted in ascending order. If it doesn't find a value bigger than it is looking for, it returns the last value found. So the trick to getting the last value is to look for something bigger than any value found in the lookup range.
My pet large number is 10^40 (a 1 followed by 40 zeros) or 1E+40. This is bigger than any number an accountant would use, even in Germany during post-World War I inflation. Other people use 1E+308, which is the largest number that Excel can swallow.
LOOKUP can also find the last text value. You do that by looking for something that sorts dead last in alphabetical order. My pet string for this purpose is "zzzzz"
My pet large number is 10^40 (a 1 followed by 40 zeros) or 1E+40. This is bigger than any number an accountant would use, even in Germany during post-World War I inflation. Other people use 1E+308, which is the largest number that Excel can swallow.
LOOKUP can also find the last text value. You do that by looking for something that sorts dead last in alphabetical order. My pet string for this purpose is "zzzzz"
ASKER
Thanks for the help. I ultimately used an array formula to get the highest (most recent) date, then pulled the needed columns. Your approach, however, offered another way of looking at it and I appreciate the lesson.
ASKER
I'm trying a combination of if and max with an array formula:
{=IF('Salary History'!B2:B8=EmployeeNam
But it's giving me the max value in that date column no matter what.