SUMPRODUCT or SUMIFS .What is the better approach to solve the problem

Kumarxl

New Member
Joined
Mar 10, 2019
Messages
4
Friends ,
I tried my best , but need help.
Table 1 contains time sheet information . hrs ,project id, manager/resource names(2 levels only)
I have been asked to get total hrs grouped by managers

Managers list : Randy, Srini, Kavin

Table 1

EMP_HRSPROJECTIDL1 NAMEL2 NAMEType
1ID12345JeffRandyFunctional
2ID12345RandyJagFunctional
10ID12345RandyJagFunctional
30ID12345SriniChandraFunctional
14ID12345RandySriniFunctional
30ID12345RandySriniFunctional
2ID12345MikeKavinFunctional
2ID12345MikeKavinFunctional
25ID89090RandyJagFunctional
30ID89090SriniChandraFunctional

<tbody>
</tbody>



=IF((COUNTIFS(Table1!$D$2:$D11,$B$1:$D$1,Table1!$B$2:$B$11,$A2,Table1!$D$2:$D$11,B$1))=0,
SUMPRODUCT(--(Table1!$B$2:$B$11=$A2),--(Table1!$E$2:$E$11="Functional"),--(ISNA(MATCH(Table1!$D$2:$D$11,$B$1:$C$1,0))),--(Table1!$C$2:$C$11=B$1),Table1!$A$2:$A$11),SUMPRODUCT((Table1!$B$2:$B$11=$A2)*(Table1!$E$2:$E$11="Functional")*((Table1!$D$2:$D$11=B$1)+(Table1!$C$2:$C$11=B$1)),Table1!$A$2:$A$11))

From the above formula , I get the below values .
Actual (from above formulae)
ProjectIDRandySriniKavin
ID1234557744

<tbody>
</tbody>


However, Randy's 57 hrs is not correct because it is adding srini's 44 hrs. I need help how to exclude Srini's hrs from Randy. Expected:

ProjectIDRandySriniKavin
ID1234513744

<tbody>
</tbody>



Any help is appreciated.
First of all, Am i moving in right direction with the above formula? or Do we have better approach to solve?
 

Excel Facts

Last used cell?
Press Ctrl+End to move to what Excel thinks is the last used cell.
How about


Excel 2013/2016
ABCDEFGHIJKLM
1EMP_HRSPROJECTIDL1 NAMEL2 NAMETypeProjectIDRandySriniKavin
21ID12345JeffRandyFunctionalID1234513744
32ID12345RandyJagFunctional
410ID12345RandyJagFunctional
530ID12345SriniChandraFunctional
614ID12345RandySriniFunctional
730ID12345RandySriniFunctional
82ID12345MikeKavinFunctional
92ID12345MikeKavinFunctional
1025ID89090RandyJagFunctional
1130ID89090SriniChandraFunctional
Data
Cell Formulas
RangeFormula
K2=SUMPRODUCT(($B$2:$B$11=$J2)*(($C$2:$C$11=K$1)+($D$2:$D$11=K$1))*($D$2:$D$11<>L$1)*($D$2:$D$11<>M$1),($A$2:$A$11))
L2=SUMPRODUCT(($B$2:$B$11=$J2)*(($C$2:$C$11=L$1)+($D$2:$D$11=L$1))*($D$2:$D$11<>M$1)*($D$2:$D$11<>K$1),($A$2:$A$11))
M2=SUMPRODUCT(($B$2:$B$11=$J2)*(($C$2:$C$11=M$1)+($D$2:$D$11=M$1))*($D$2:$D$11<>K$1)*($D$2:$D$11<>L$1),($A$2:$A$11))
 
Upvote 0
Thanks for quick Response . Challenge is I have 100+ managers in the header range(manager name. e.g $k$1 - $AZ$1) .Is there way to exclude a value from the range instead of using l1,m1. etc
($D$2:$D$11<>L$1)*($D$2:$D$11<>M$1)
 
Upvote 0
Whilst it may be possible, I don't know how.
But I don't understand why you want rows 3 & 4 to Randy rather than the L2name, but rows 6 & 7 are added to the L2name & not Randy
 
Upvote 0
SUM Rows 3 & 4 to Randy , because L2Name Jag is not a manager .
SUM Rows 6 & 7 to Srini , because l2name Srini is a manager .

Basically we wants hrs grouped by the managers (Manager hrs+reportee) at the lowest level .

In this case Randy is Sr Manager, Srini is manager and Jag is Sr analyst,Chandra is analyst . Jag and srini are reporting to Randy and Chandra is reporting to Srini.
So Srini's hrs and Chandra's hrs will added to Srini's column( as srini is the manager and present in the header range) .Jags hrs and Randy's hrs will be added to Randy's column .

Confusing :)
 
Upvote 0

Forum statistics

Threads
1,214,667
Messages
6,120,814
Members
448,990
Latest member
rohitsomani

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top