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)
 
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
Now I know something new about Power Query! Thank you so much for the great example and solution!
 
Upvote 0

Excel Facts

How to calculate loan payments in Excel?
Use the PMT function: =PMT(5%/12,60,-25000) is for a $25,000 loan, 5% annual interest, 60 month loan.

Forum statistics

Threads
1,223,884
Messages
6,175,175
Members
452,615
Latest member
bogeys2birdies

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