Howdy
Sorry about the way the tables appear - I can't get the sheet uploading tools to work properly.
If I understand your explanation correctly:
- You really have two source data tables:
- Employee code x month x allocated business unit (There's an assumption here that each employee is allocated 100% to a business in each month, rather than being split between more than one unit)
- Employee code x month x monthly payroll cost
- Your ultimate objective is to calculate the monthly payroll cost for each business unit.
If the above is correct, then I think the solution is relatively simple.
- I would lay out the employee cost table (#1.2 above) in the same way as the Employee code x month x allocated business unit table (#1.1 above) shown in your post.
- These two tables should then have exactly the same dimensions - except for the total row.
Below are sample tables using some sample data to demonstrate:
Table 1 (A1:M4)
Table 2 (A6:M10)
[TABLE="width: 643"]
<tbody>[TR]
[TD="width: 82"]Employee[/TD]
[TD="width: 64"]Jan-19[/TD]
[TD="width: 64"]Feb-19[/TD]
[TD="width: 68"]Mar-19[/TD]
[TD="width: 64"]Apr-19[/TD]
[TD="width: 65"]May-19[/TD]
[TD="width: 64"]Jun-19[/TD]
[TD="width: 64"]Jul-19[/TD]
[TD="width: 65"]Aug-19[/TD]
[TD="width: 64"]Sep-19[/TD]
[TD="width: 64"]Oct-19[/TD]
[TD="width: 65"]Nov-19[/TD]
[TD="width: 64"]Dec-19[/TD]
[/TR]
[TR]
[TD]143[/TD]
[TD]TNT[/TD]
[TD]TNT[/TD]
[TD]TNT[/TD]
[TD]TNT[/TD]
[TD]TNT[/TD]
[TD]TNT[/TD]
[TD]TNT[/TD]
[TD]TNT[/TD]
[TD]TNT[/TD]
[TD]TNT[/TD]
[TD]TNT[/TD]
[TD]TNT[/TD]
[/TR]
[TR]
[TD]144[/TD]
[TD]TNT[/TD]
[TD]TNT[/TD]
[TD]TNT[/TD]
[TD]TNT[/TD]
[TD]TNT[/TD]
[TD]TNT[/TD]
[TD]TNT[/TD]
[TD]TNT[/TD]
[TD]TNT[/TD]
[TD]TNT[/TD]
[TD]TNT[/TD]
[TD]TNT[/TD]
[/TR]
[TR]
[TD]145[/TD]
[TD]TNT[/TD]
[TD]FTTX[/TD]
[TD]FTTX[/TD]
[TD]FTTX[/TD]
[TD]FTTX[/TD]
[TD]FTTX[/TD]
[TD]FTTX[/TD]
[TD]FTTX[/TD]
[TD]FTTX[/TD]
[TD]FTTX[/TD]
[TD]FTTX[/TD]
[TD]FTTX[/TD]
[/TR]
[TR]
[TD="bgcolor: transparent"][/TD]
[TD="bgcolor: transparent"][/TD]
[TD="bgcolor: transparent"][/TD]
[TD="bgcolor: transparent"][/TD]
[TD="bgcolor: transparent"][/TD]
[TD="bgcolor: transparent"][/TD]
[TD="bgcolor: transparent"][/TD]
[TD="bgcolor: transparent"][/TD]
[TD="bgcolor: transparent"][/TD]
[TD="bgcolor: transparent"][/TD]
[TD="bgcolor: transparent"][/TD]
[TD="bgcolor: transparent"][/TD]
[TD="bgcolor: transparent"][/TD]
[/TR]
[TR]
[TD]Employee[/TD]
[TD]Jan
-19[/TD]
[TD]Feb-19[/TD]
[TD]Mar-19[/TD]
[TD]Apr-19[/TD]
[TD]May-19[/TD]
[TD]Jun-19[/TD]
[TD]Jul-19[/TD]
[TD]Aug-19[/TD]
[TD]Sep-19[/TD]
[TD]Oct-19[/TD]
[TD]Nov-19[/TD]
[TD]Dec-19[/TD]
[/TR]
[TR]
[TD]143[/TD]
[TD]1,000 [/TD]
[TD]1,500[/TD]
[TD]2,000[/TD]
[TD]2,500[/TD]
[TD]3,000[/TD]
[TD]3,500[/TD]
[TD]4,000[/TD]
[TD]4,500[/TD]
[TD]5,000[/TD]
[TD]5,500[/TD]
[TD]6,000[/TD]
[TD]6,500[/TD]
[/TR]
[TR]
[TD]144[/TD]
[TD]1,000 [/TD]
[TD]1,500[/TD]
[TD]2,000[/TD]
[TD]2,500[/TD]
[TD]3,000[/TD]
[TD]3,500[/TD]
[TD]4,000[/TD]
[TD]4,500[/TD]
[TD]5,000[/TD]
[TD]5,500[/TD]
[TD]6,000[/TD]
[TD]6,500[/TD]
[/TR]
[TR]
[TD]145[/TD]
[TD]1,000[/TD]
[TD]1,500[/TD]
[TD]2,000[/TD]
[TD]2,500[/TD]
[TD]3,000[/TD]
[TD]3,500[/TD]
[TD]4,000[/TD]
[TD]4,500[/TD]
[TD]5,000[/TD]
[TD]5,500[/TD]
[TD]6,000[/TD]
[TD]6,500[/TD]
[/TR]
[TR]
[TD]Total[/TD]
[TD]3,000[/TD]
[TD]4,500[/TD]
[TD]6,000[/TD]
[TD]7,500[/TD]
[TD]9,000[/TD]
[TD]10,500[/TD]
[TD]12,000[/TD]
[TD]13,500[/TD]
[TD]15,000[/TD]
[TD]16,500[/TD]
[TD]18,000[/TD]
[TD]19,500[/TD]
[/TR]
</tbody>[/TABLE]
The final result table (business unit x month x total payroll cost) should also be laid in a similar fashion (business units down the LHS and months across the top).
Table 3 (A13:M16)
[TABLE="width: 643"]
<tbody>[TR]
[TD="width: 82"]Unit[/TD]
[TD="width: 64"]Jan-19[/TD]
[TD="width: 64"]Feb-19[/TD]
[TD="width: 68"]Mar-19[/TD]
[TD="width: 64"]Apr-19[/TD]
[TD="width: 65"]May-19[/TD]
[TD="width: 64"]Jun-19[/TD]
[TD="width: 64"]Jul-19[/TD]
[TD="width: 65"]Aug-19[/TD]
[TD="width: 64"]Sep-19[/TD]
[TD="width: 64"]Oct-19[/TD]
[TD="width: 65"]Nov-19[/TD]
[TD="width: 64"]Dec-19[/TD]
[/TR]
[TR]
[TD]TNT[/TD]
[TD="align: right"]
3,000 [/TD]
[TD="align: right"]
3,000 [/TD]
[TD="align: right"]
4,000 [/TD]
[TD="align: right"]
5,000 [/TD]
[TD="align: right"]
6,000 [/TD]
[TD="align: right"]
7,000 [/TD]
[TD="align: right"]
8,000 [/TD]
[TD="align: right"]
9,000 [/TD]
[TD="align: right"]
10,000 [/TD]
[TD="align: right"]
11,000 [/TD]
[TD="align: right"]
12,000 [/TD]
[TD="align: right"]
13,000 [/TD]
[/TR]
[TR]
[TD]FTTX[/TD]
[TD="align: right"]
-[/TD]
[TD="align: right"]
1,500 [/TD]
[TD="align: right"]
2,000 [/TD]
[TD="align: right"]
2,500 [/TD]
[TD="align: right"]
3,000 [/TD]
[TD="align: right"]
3,500 [/TD]
[TD="align: right"]
4,000 [/TD]
[TD="align: right"]
4,500 [/TD]
[TD="align: right"]
5,000 [/TD]
[TD="align: right"]
5,500 [/TD]
[TD="align: right"]
6,000 [/TD]
[TD="align: right"]
6,500 [/TD]
[/TR]
[TR]
[TD]Total[/TD]
[TD]3,000[/TD]
[TD]4,500[/TD]
[TD]6,000[/TD]
[TD]7,500[/TD]
[TD]9,000[/TD]
[TD]10,500[/TD]
[TD]12,000[/TD]
[TD]13,500
[/TD]
[TD]15,000[/TD]
[TD]16,500[/TD]
[TD]18,000[/TD]
[TD]19,500[/TD]
[/TR]
</tbody>[/TABLE]
The formula at the intersection of business unit code x month is like this:
TNT x Jan-19 (B14) = SUMPRODUCT( ( B$2:B$4 = $A14 ) * ( B$7:B$9 ) )
FTTX x Jan-19 (B15) = SUMPRODUCT( ( B$2:B$4 = $A15 ) * ( B$7:B$9 ) )
(These formula should be using structured references as they reference tables but for some unknown reason my XL2007 is misbehaving!)
Does this do what you're seeking?