Sum of multiple rows for each employee

zinah

Active Member
Joined
Nov 28, 2018
Messages
368
Office Version
  1. 365
Platform
  1. Windows
Hi,
I have below sheet that has multiple rows for each employee ID and what I need is to get a proper formula to sum amount 1 and sum amount 2 for each employee, can you help pls?

Book2
ABCDE
1Employee IDAmount 1Amount 2Sum Amount1Sum Amount2
2ABCD4,939.444,939.44127,797.10126,297.10
3ABCD5,389.445,389.44
4ABCD5,239.444,939.44
5ABCD4,939.444,939.44
6ABCD5,239.444,939.44
7ABCD5,389.445,389.44
8ABCD4,939.444,939.44
9ABCD5,839.445,839.44
10ABCD4,939.444,939.44
11ABCD5,389.445,389.44
12ABCD4,939.444,939.44
13ABCD5,389.445,389.44
14ABCD5,239.444,939.44
15ABCD4,939.444,939.44
16ABCD4,939.444,939.44
17ABCD4,939.444,939.44
18ABCD5,239.444,939.44
19ABCD4,939.444,939.44
20ABCD4,738.074,738.07
21ABCD10,546.8310,546.83
22ABCD4,738.074,738.07
23ABCD5,188.075,188.07
24ABCD5,038.074,738.07
25ABCD4,738.074,738.07
26EFGH9,274.859,274.85
27EFGH6,745.356,745.35
28EFGH6,745.356,745.35
29EFGH2,529.502,529.50
30EFGH6,745.356,745.35
31EFGH6,855.386,855.38
32EFGH6,745.356,745.35
33EFGH9,274.859,274.85
34EFGH6,745.356,745.35
35EFGH9,274.859,274.85
36EFGH6,745.356,745.35
37EFGH10,286.6610,286.66
38EFGH6,745.356,745.35
39EFGH9,274.859,274.85
40EFGH6,745.356,745.35
41EFGH9,274.859,274.85
42EFGH6,745.356,745.35
43EFGH14,550.3214,550.32
44EFGH6,745.356,745.35
45EFGH8,708.788,708.78
46EFGH6,333.666,333.66
47EFGH8,708.788,708.78
48EFGH6,333.666,333.66
49EFGH12,561.5712,561.57
50EFGH6,333.666,333.66
51A123417,708.3417,708.34
52A123417,708.3417,708.34
53A123417,708.3417,708.34
54A123417,708.3417,708.34
55A123417,708.3417,708.34
56A123417,708.3417,708.34
57A123417,708.3417,708.34
58A123417,708.3417,708.34
59A123417,708.3417,708.34
60A123417,708.3417,708.34
61A123417,708.3417,708.34
62A123417,708.3417,708.34
63A123417,708.3417,708.34
64A123417,708.3417,708.34
65A123417,708.3417,708.34
66A123417,708.3417,708.34
67A123417,708.3417,708.34
68A123417,708.3417,708.34
69A123483,117.5983,117.59
70A123417,708.3417,708.34
71A123417,708.3417,708.34
72A123417,708.3417,708.34
73A123417,708.3417,708.34
74A123417,708.3417,708.34
75B12343,428.753,428.75
76B12343,428.753,428.75
77B12343,428.753,428.75
78B12343,428.753,428.75
79B12343,428.753,428.75
80B12343,428.753,428.75
81B12343,428.753,428.75
82B12343,428.753,428.75
83B12343,428.753,428.75
84B12343,428.753,428.75
85B12343,428.753,428.75
86B12343,428.753,428.75
87B12343,428.753,428.75
88B12343,428.753,428.75
89B12343,428.753,428.75
90B12343,428.753,428.75
91B12343,428.753,428.75
92B12343,428.753,428.75
93B12343,250.003,250.00
94B12347,177.697,177.69
95B12343,250.003,250.00
96B12343,250.003,250.00
97B12343,250.003,250.00
98B12343,250.003,250.00
Sheet4
Cell Formulas
RangeFormula
D2:E2D2=SUM(B2:B25)
 

Excel Facts

When they said...
When they said you are going to "Excel at life", they meant you "will be doing Excel your whole life".
try this:
Book1
ABCDEFGHI
1Employee IDAmount 1Amount 2Sum Amount1Sum Amount2
2ABCD4939.444939.44127797.1126297.1ABCD127797.1126297.1
3ABCD5389.445389.44EFGH197029.7197029.7
4ABCD5239.444939.44A1234490409.4490409.4
5ABCD4939.444939.44B123485145.1985145.19
6ABCD5239.444939.44
7ABCD5389.445389.44
8ABCD4939.444939.44
9ABCD5839.445839.44
10ABCD4939.444939.44
11ABCD5389.445389.44
12ABCD4939.444939.44
13ABCD5389.445389.44
14ABCD5239.444939.44
15ABCD4939.444939.44
16ABCD4939.444939.44
17ABCD4939.444939.44
18ABCD5239.444939.44
19ABCD4939.444939.44
20ABCD4738.074738.07
21ABCD10546.8310546.83
22ABCD4738.074738.07
23ABCD5188.075188.07
24ABCD5038.074738.07
25ABCD4738.074738.07
26EFGH9274.859274.85
27EFGH6745.356745.35
28EFGH6745.356745.35
29EFGH2529.52529.5
30EFGH6745.356745.35
31EFGH6855.386855.38
32EFGH6745.356745.35
33EFGH9274.859274.85
34EFGH6745.356745.35
35EFGH9274.859274.85
36EFGH6745.356745.35
37EFGH10286.6610286.66
38EFGH6745.356745.35
39EFGH9274.859274.85
40EFGH6745.356745.35
41EFGH9274.859274.85
42EFGH6745.356745.35
43EFGH14550.3214550.32
44EFGH6745.356745.35
45EFGH8708.788708.78
46EFGH6333.666333.66
47EFGH8708.788708.78
48EFGH6333.666333.66
49EFGH12561.5712561.57
50EFGH6333.666333.66
51A123417708.3417708.34
52A123417708.3417708.34
53A123417708.3417708.34
54A123417708.3417708.34
55A123417708.3417708.34
56A123417708.3417708.34
57A123417708.3417708.34
58A123417708.3417708.34
59A123417708.3417708.34
60A123417708.3417708.34
61A123417708.3417708.34
62A123417708.3417708.34
63A123417708.3417708.34
64A123417708.3417708.34
65A123417708.3417708.34
66A123417708.3417708.34
67A123417708.3417708.34
68A123417708.3417708.34
69A123483117.5983117.59
70A123417708.3417708.34
71A123417708.3417708.34
72A123417708.3417708.34
73A123417708.3417708.34
74A123417708.3417708.34
75B12343428.753428.75
76B12343428.753428.75
77B12343428.753428.75
78B12343428.753428.75
79B12343428.753428.75
80B12343428.753428.75
81B12343428.753428.75
82B12343428.753428.75
83B12343428.753428.75
84B12343428.753428.75
85B12343428.753428.75
86B12343428.753428.75
87B12343428.753428.75
88B12343428.753428.75
89B12343428.753428.75
90B12343428.753428.75
91B12343428.753428.75
92B12343428.753428.75
93B123432503250
94B12347177.697177.69
95B123432503250
96B123432503250
97B123432503250
98B123432503250
Sheet1
Cell Formulas
RangeFormula
D2:E2D2=SUM(B2:B25)
G2:G5G2=UNIQUE(A2:A98)
H2:H5H2=SUM(FILTER($B$2:$B$98,$G2=$A$2:$A$98,""))
I2:I5I2=SUM(FILTER($C$2:$C$98,$G2=$A$2:$A$98,""))
Dynamic array formulas.
 
Upvote 1
Why not use Subtotals.....
Data Tab>>Outline>>Subtotals>>>and then select these options

1709677378471.png
 
Upvote 0
try this:
Book1
ABCDEFGHI
1Employee IDAmount 1Amount 2Sum Amount1Sum Amount2
2ABCD4939.444939.44127797.1126297.1ABCD127797.1126297.1
3ABCD5389.445389.44EFGH197029.7197029.7
4ABCD5239.444939.44A1234490409.4490409.4
5ABCD4939.444939.44B123485145.1985145.19
6ABCD5239.444939.44
7ABCD5389.445389.44
8ABCD4939.444939.44
9ABCD5839.445839.44
10ABCD4939.444939.44
11ABCD5389.445389.44
12ABCD4939.444939.44
13ABCD5389.445389.44
14ABCD5239.444939.44
15ABCD4939.444939.44
16ABCD4939.444939.44
17ABCD4939.444939.44
18ABCD5239.444939.44
19ABCD4939.444939.44
20ABCD4738.074738.07
21ABCD10546.8310546.83
22ABCD4738.074738.07
23ABCD5188.075188.07
24ABCD5038.074738.07
25ABCD4738.074738.07
26EFGH9274.859274.85
27EFGH6745.356745.35
28EFGH6745.356745.35
29EFGH2529.52529.5
30EFGH6745.356745.35
31EFGH6855.386855.38
32EFGH6745.356745.35
33EFGH9274.859274.85
34EFGH6745.356745.35
35EFGH9274.859274.85
36EFGH6745.356745.35
37EFGH10286.6610286.66
38EFGH6745.356745.35
39EFGH9274.859274.85
40EFGH6745.356745.35
41EFGH9274.859274.85
42EFGH6745.356745.35
43EFGH14550.3214550.32
44EFGH6745.356745.35
45EFGH8708.788708.78
46EFGH6333.666333.66
47EFGH8708.788708.78
48EFGH6333.666333.66
49EFGH12561.5712561.57
50EFGH6333.666333.66
51A123417708.3417708.34
52A123417708.3417708.34
53A123417708.3417708.34
54A123417708.3417708.34
55A123417708.3417708.34
56A123417708.3417708.34
57A123417708.3417708.34
58A123417708.3417708.34
59A123417708.3417708.34
60A123417708.3417708.34
61A123417708.3417708.34
62A123417708.3417708.34
63A123417708.3417708.34
64A123417708.3417708.34
65A123417708.3417708.34
66A123417708.3417708.34
67A123417708.3417708.34
68A123417708.3417708.34
69A123483117.5983117.59
70A123417708.3417708.34
71A123417708.3417708.34
72A123417708.3417708.34
73A123417708.3417708.34
74A123417708.3417708.34
75B12343428.753428.75
76B12343428.753428.75
77B12343428.753428.75
78B12343428.753428.75
79B12343428.753428.75
80B12343428.753428.75
81B12343428.753428.75
82B12343428.753428.75
83B12343428.753428.75
84B12343428.753428.75
85B12343428.753428.75
86B12343428.753428.75
87B12343428.753428.75
88B12343428.753428.75
89B12343428.753428.75
90B12343428.753428.75
91B12343428.753428.75
92B12343428.753428.75
93B123432503250
94B12347177.697177.69
95B123432503250
96B123432503250
97B123432503250
98B123432503250
Sheet1
Cell Formulas
RangeFormula
D2:E2D2=SUM(B2:B25)
G2:G5G2=UNIQUE(A2:A98)
H2:H5H2=SUM(FILTER($B$2:$B$98,$G2=$A$2:$A$98,""))
I2:I5I2=SUM(FILTER($C$2:$C$98,$G2=$A$2:$A$98,""))
Dynamic array formulas.
Thanks a lot for your suggestion! Is there a way we can use the unique and sum in one formula? This way I will not create another table with only the employee ID and both amounts? As the original table has more than 10 columns.
 
Upvote 0
You could use this formula.



And for a spill array result.
I liked your suggested formula, but what I need is to get one sum for all the multiple employee ID, then I will pivot the sum columns to get the total amount of all unique employee IDs.
 
Upvote 0
Why not use Subtotals.....
Data Tab>>Outline>>Subtotals>>>and then select these options

View attachment 107933
Thank you for your suggestion, this can work, however, what I'm looking to get as an end result is like below table, the sum amounts of each employee (amount 1 and 2) and check if there's any match, with your suggestion I don't think it will work:

Sum Amount1Sum Amount2
Match?​
ABCD​
127797.1​
126297.1​
FALSE​
EFGH​
197029.72​
197029.72​
TRUE​
A1234​
490409.41​
490409.41​
TRUE​
B1234​
85145.19​
85145.19​
TRUE​
 
Upvote 0
For this final result you can use the formula bellow:
=LET(u,UNIQUE(A2:A98),b,SUMIF(A2:A98,u,B2:B98),c,SUMIF(A2:A98,u,C2:C98),HSTACK(u,b,c,b=c))
 
Upvote 1
Solution
Here is an alternative solution with Power Query

Power Query:
let
    Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Employee ID", type text}, {"Amount 1", type number}, {"Amount 2", type number}}),
    #"Grouped Rows" = Table.Group(#"Changed Type", {"Employee ID"}, {{"Total 1", each List.Sum([Amount 1]), type nullable number}, {"Total 2", each List.Sum([Amount 2]), type nullable number}}),
    #"Added Custom" = Table.AddColumn(#"Grouped Rows", "Match", each if [Total 1]=[Total 2] then "TRUE" else "FALSE")
in
    #"Added Custom"

Book1
EFGH
1Employee IDTotal 1Total 2Match
2ABCD127797.1126297.1FALSE
3EFGH197029.72197029.72TRUE
4A1234490409.41490409.41TRUE
5B123485145.1985145.19TRUE
Sheet1
 
Upvote 1

Forum statistics

Threads
1,223,228
Messages
6,170,871
Members
452,363
Latest member
merico17

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