2
I have a dataset that resembles the following:
name year contracted-period salary
peter 2012 2012-2014 $65
peter 2013 2012-2014 $70
peter 2014 2012-2014 $90
tom 2012 2012-2013 $110
tom 2013 2012-2013 $140
What i want is to create a new column that has the average salary for each name over that contract period i.e. each row in the column for peter would have his average salary over the contract
name year contracted-period salary average-per-contract
peter 2012 2012-2014 $65 $75
peter 2013 2012-2014 $70 $75
peter 2014 2012-2014 $90 $75
tom 2012 2012-2013 $110 $125
tom 2013 2012-2013 $140 $125
I imagine the formula will have something to do with averageifs but i haven't been able to work it out.
Any help would be amazing
Thanks, that's very useful. What about when each person has multiple contracts. For instance, if peter also had a 2015-2016 contract in the data set? – Rissol – 2017-11-13T22:21:44.510