Sum dataset by month and year separately

drluke

Active Member
Joined
Apr 17, 2014
Messages
314
Office Version
  1. 365
Platform
  1. Windows
I have a dataset of product sales by period and customer. Every new period data for that period is added to the dataset (i.e. the dataset has cumulative information in it).

Every period a report is prepared for each customer showing product sales for the period and the year to date. So period 2 will have a column showing period 2 sales and a column showing period 1+2 sales. Every periodical report is a new workbook.

My question is how to add together the cumulative sales without having to link to each periodical workbook. Ideally I want to use the cumulative dataset (which is in every new workbook) to do it.

Any advice much appreciated.

Book1
ABCDEFGHIJKLMNOPQRS
1PerC NumbBlueGreenRedPinkTOTALC Numb1010C Numb1010
21101010052645815642648Per1Per2
3110204583261125581967
4110308569955586477201YTD2YTD
51104075899954586523520574Blue100100Blue653753
62101065333345893524640821Green526526Green333859
7210204583261125581967Red458458Red45895047
821030856995558647720Pink15641564Pink3524636810
92104075899954586523520574TOTAL26482648TOTAL4082143469
103101010052645815642648
11310204583261125581967Workbook 1Workbook 2
1231030856995558647720
133104075899954586523520574
14
15
16
Sheet1
Cell Formulas
RangeFormula
M5M5=SUMIFS($C$2:$C$13,$B$2:$B$13,$M$1,$A$2:$A$13,$M$2)
N5:N8N5=M5
M6M6=SUMIFS($D$2:$D$13,$B$2:$B$13,$M$1,$A$2:$A$13,$M$2)
M7M7=SUMIFS($E$2:$E$13,$B$2:$B$13,$M$1,$A$2:$A$13,$M$2)
M8M8=SUMIFS($F$2:$F$13,$B$2:$B$13,$M$1,$A$2:$A$13,$M$2)
M9:N9,Q9:R9M9=SUM(M5:M8)
Q5Q5=SUMIFS($C$2:$C$13,$B$2:$B$13,$Q$1,$A$2:$A$13,$Q$2)
Q6Q6=SUMIFS($D$2:$D$13,$B$2:$B$13,$Q$1,$A$2:$A$13,$Q$2)
Q7Q7=SUMIFS($E$2:$E$13,$B$2:$B$13,$Q$1,$A$2:$A$13,$Q$2)
Q8Q8=SUMIFS($F$2:$F$13,$B$2:$B$13,$Q$1,$A$2:$A$13,$Q$2)
G2:G13G2=SUM(C2:F2)
 

Excel Facts

Why does 9 mean SUM in SUBTOTAL?
It is because Sum is the 9th alphabetically in Average, Count, CountA, Max, Min, Product, StDev.S, StDev.P, Sum, VAR.S, VAR.P.
You could use Power Query to update the data set in each new workbook from your master data table.

e.g. update your master sheet, when you open a customer workbook & refresh it calls the updated data from the master sheet.
 
Upvote 0
Maybe

Book1
LMNOPQR
1C Numb1010C Numb1010
2Per1Per2
3
41YTD2YTD
5Blue100100Blue653753
6Green526526Green333859
7Red458458Red45895047
8Pink15641564Pink3524636810
9TOTAL26482648TOTAL4082143469
10
11Workbook 1Workbook 2
Sheet1
Cell Formulas
RangeFormula
M5:M8M5=SUMPRODUCT(($B$2:$B$13=$M$1)*($A$2:$A$13=$M$2)*($C$1:$F$1=L5)*$C$2:$F$13)
N5:N9N5=M5
M9M9=SUMPRODUCT(($B$2:$B$13=$M$1)*($A$2:$A$13=$M$2)*$C$2:$F$13)
Q5:Q8Q5=SUMPRODUCT(($B$2:$B$13=$Q$1)*($A$2:$A$13=$Q$2)*($C$1:$F$1=P5)*$C$2:$F$13)
R5:R8R5=SUMPRODUCT(($B$2:$B$13=$Q$1)*($A$2:$A$13>=$Q$2)*($C$1:$F$1=P5)*$C$2:$F$13)
Q9Q9=SUMPRODUCT(($B$2:$B$13=$Q$1)*($A$2:$A$13=$Q$2)*$C$2:$F$13)
R9R9=SUMPRODUCT(($B$2:$B$13=$Q$1)*($A$2:$A$13>=$Q$2)*$C$2:$F$13)
 
Upvote 0

Forum statistics

Threads
1,223,227
Messages
6,170,849
Members
452,361
Latest member
d3ad3y3

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