Code:
Office	Employee	Start Date	Exit Date	Basic per Month
Office1	Person1	01/01/2014	01/11/2014	10000
Office1	Person2	01/02/2015	01/05/2018	10000
Office2	Person3	01/06/2016	01/07/2018	10000
Office3	Person4	01/01/2014	01/12/2018	10000
Office3	Person5	01/01/2014	01/12/2018	10000
Code:
2014		Office1	Office2	Office3
Salaries
I need a formula in the 2nd table to calculate salaries by Office and Year (2014 in the above example, but this is a dropdown so can be 2015 or 2016 etc) for the year selected based on the start and exit dates and the monthly basic in the table above,

Any guidance appreciated!