I have a list of people with 10 years of salary history for each (in ten consecutive columns on the spreadsheet). I need to calculate salary average for 5 consecutive highest years within the last 10 years. Please see example. If employee has less than 5 years, then it should just average the years employee has. Some people have breaks in service, for example employee worked 2011, 2010, 2009 and 2005, 2004, 2003. 2008, 2007, 2006 years should be ignored and skipped in calculating the averages to the next. Depending which combination (2011, 2010, 2009, 2005, 2004 or 2010, 2009, 2005, 2004, 2003) has the highest average would be consider.
Could someone please help me? Example 1.xls
Thank you.
P.S. I worked on this project over a month ago, and daddylonglegs provided the formula:
=IF(COUNT(B2:K2)<5,AVERAGE(B2:K2),MAX(SUBTOTAL(9,OFFSET(B2,0,COLUMN(B2:G2)-COLUMN(B2),1,5))/5))
However after reviewing and testing over 3000 people, it turned out the formula does not work properly.
Bookmarks