Search code examples
excelexcel-formulasumproduct

Excel: SUMPRODUCT calculating shared workload in hours with multiple percentages


This is the same problem as (Excel: SUMPRODUCT calculating shared workload in hours with percentages) with an addition.

I'm trying to calculate the workload/hours for each employee for certain projects. In column B you can see the responsible (100% of the workload), in C you can see which employee is taking 50% or 25% of the workload off the responsible employee. So I need the sum of all hours, while deducing of adding the 50% or 25% in case the workload is shared and giving it to the employee helping.

The latest formula adding/subtracting only the 50% in C:

=SOMPRODUCT(($A6=$B$2:$B$5)*($B$1-$C$1*(""<>$C$2:$C$5))*E$2:E$5+($A6=$C$2:$C$5)*$C$1*E$2:E$5)

What would be the most elegant solution? I need the option to change the percentage.

enter image description here

100%        50%     25%         Day 1   Day 2   Day 3
Project 1   Mark    Peter       6       2        6
Project 2   Peter   Lily        2       8        2
Project 3   Peter   Lily        0       4        8
Project 4   Lily    Mark        4       0        2
Mark                            8       2        7
Peter                           1       8        9
Lily                            3       4        2

Solution

  • Perhaps:

       = SUM(($B$2:$D$5=$A6)*$B$1:$D$1*E$2:E$5)
       - SUM( ($B$2:$B$5=$A6)*NOT(ISBLANK($C$2:$D$5))*($C$2:$D$5<>$A6)*E$2:E$5*$C$1:$D$1 )
    

    enter image description here