Calculate Sum of values based on groupings.

h2lm2t

New Member
Joined
Sep 8, 2007
Messages
4
I am looking for a way/function to calculate SUM values in ColumnC based in the following data:

Column C needs to sum all the values in Column B as long as the grouping in ColumnA is the same.

Each row in Column C generates value 0 if the row1 colA and row2 colA are the same, otherwise it aggregates the sum values with the same group in Column A.

A B C
10 1 0
10 2 0
10 3 0
10 4 10
20 5 0
20 6 11
30 7 0
30 8 0
30 9 0

Please kindly let me know. Thanks in advance!

-Sam
 

Some videos you may like

Excel Facts

Best way to learn Power Query?
Read M is for (Data) Monkey book by Ken Puls and Miguel Escobar. It is the complete guide to Power Query.

barry houdini

MrExcel MVP
Joined
Mar 23, 2005
Messages
20,825
Hello Sam,

Welcome to MrExcel. Assuming your data starts in row 1 try this formula in C1 copied down

=IF(A1=A2,0,SUMIF(A:A,A1,B:B))

Note: this post is duplicated, can you delete the other one, please. [click on the X to delete]
 

h2lm2t

New Member
Joined
Sep 8, 2007
Messages
4
Quick questions. What if the the data doesn't start in row 1?

Thanks,
SAM
 

barry houdini

MrExcel MVP
Joined
Mar 23, 2005
Messages
20,825
You can adjust accordingly...e.g. if data starts at row 5 then use this formula in C5 copied down

=IF(A5=A6,0,SUMIF(A$5:A5,A5,B$5:B5))
 

Watch MrExcel Video

Forum statistics

Threads
1,122,371
Messages
5,595,777
Members
414,020
Latest member
Meghdad

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
Top