Hey guys,
I asked in the other section of the forum how to shorten a SUMPRODUCT function, but I guess it is not possible. Can I achieve this with a macro ?
There are 100 projects per department, each project is done twice per year. Each project can have up to 4 people working on it, and they can be from any department.
For example - Project 1, people working on first leg are from D4 to D7 and the amount of days worked is at L6. Second leg people working on project is from H4 to H7 and the amount of days is at L7. On Sheet HR, each employee has a name and a cell for amount of days worked for each month. For example the first employee is at A3, start of month is at E1, and the total amount of days worked for the month is at E4.
the formula for this one project looks like that:
=(SUMPRODUCT(Dept1!$L$6:$W$6;(Dept1!$L$2:$W$2=HR!E$1)*(Dept1!$D$4=HR!$A3))+ (SUMPRODUCT(Dept1!$L$7:$W$7;(Dept1!$L$2:$W$2=HR!E$1)*(Dept1!$H$4=HR!$A3))))+
(SUMPRODUCT(Dept2!$L$6:$W$6;(Dept2!$L$2:$W$2=HR!E$1)*(Dept2!$D$4=HR!$A3))+ (SUMPRODUCT(Dept2!$L$7:$W$7;(Dept2!$L$2:$W$2=HR!E$1)*(Dept2!$H$4=HR!$A3))))+
(SUMPRODUCT(Dept3!$L$6:$W$6;(Dept3!$L$2:$W$2=HR!E$1)*(Dept3!$D$4=HR!$A3))+ (SUMPRODUCT(Dept3!$L$7:$W$7;(Dept3!$L$2:$W$2=HR!E$1)*(Dept3!$H$4=HR!$A3))))+
(SUMPRODUCT(Dept4!$L$6:$W$6;(Dept4!$L$2:$W$2=HR!E$1)*(Dept4!$D$4=HR!$A3))+ (SUMPRODUCT(Dept4!$L$7:$W$7;(Dept4!$L$2:$W$2=HR!E$1)*(Dept4!$H$4=HR!$A3))))+
(SUMPRODUCT(Dept5!$L$6:$W$6;(Dept5!$L$2:$W$2=HR!E$1)*(Dept5!$D$4=HR!$A3))+ (SUMPRODUCT(Dept5!$L$7:$W$7;(Dept5!$L$2:$W$2=HR!E$1)*(Dept5!$H$4=HR!$A3))))+
(SUMPRODUCT(Dept1!$L$6:$W$6;(Dept1!$L$2:$W$2=HR!E$1)*(Dept1!$D$5=HR!$A3))+ (SU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to sum 120 times this formula, which is not possible. The only option I could think of is to make 120 sheets (one for each project) and compose a table with employee/month. Them sum all that in the HR tab.
Any ideas would be greatly appreciated!
Here is the file:
Bookmarks