Sum Sales Values by Dates over different periods

Zakky

Board Regular
Joined
Mar 26, 2016
Messages
152
Office Version
  1. 365
Platform
  1. Windows
Hello, I have a few challenges that I need your help with. I have a daily sales log which i have to convert to provide data in three different formats:
1) weekly - sum 7 consecutive days from a starting date;
2) weekly - starting 1st of each month and up to including Sunday of that week. The working week is from Monday to Sunday, but if 1st of the month is, say, Friday then it has to start from Friday and up to including week ending Sunday, so 3 days trading for that week. So week ending dates from the 1st will be displayed as header.
3) monthly - starting from the 1st and up to including last day of the month. Regardless on what day the month ends, it has to be up the last day of the month.

The cells in blue are currently all manual SUM values. I t would be great if there were dynamic functions that could do the heavy lifting as and all the dates should be driven from data in row 2 (Daily Units Sold).

Daily Sales.PNG

Thank you!
 

Excel Facts

Copy a format multiple times
Select a formatted range. Double-click the Format Painter (left side of Home tab). You can paste formatting multiple times. Esc to stop
apologies I've run out of time today and need to leave the office, but heres a solution for your first 7 days ..

Perhaps others might join in now the data is here for them to easily use : ignore formula in C2, that was for me to get your dates in.

Book1
ABCDEFGHIJKLMNOPQRSTUVWXYZAAAB
1Daily Units Sold
2Product01-Jan-1802-Jan-1803-Jan-1804-Jan-1805-Jan-1806-Jan-1807-Jan-1808-Jan-1809-Jan-1810-Jan-1811-Jan-1812-Jan-1813-Jan-1814-Jan-1815-Jan-1816-Jan-1817-Jan-1818-Jan-1819-Jan-1820-Jan-1821-Jan-1822-Jan-1823-Jan-1824-Jan-1825-Jan-1826-Jan-18
3MonTueWedThuFriSatSunMonTueWedThuFriSatSunMonTueWedThuFnSatSunMonTueWedThuFnSat
4A150180216259311373448537300360432295355426511285342410281337404485249299358430516
5
6Weekly
7A07-Jan-1814-Jan-1821-Jan-1828-Jan-1804-Feb-18
81937270525701821
9
10Weekly (from the 1st of each month up to and including Sunday of that week. The working week is from Monday to Sunday. The last week has to be up to the last day of the month even if the last week is only. say. a 4-day week)
11A07-Jan-1814-Jan-1821-Jan-18 28-Jan-18 31-Jan-1804-Feb-18and so on..
121,9372,7052,5702,9567471
13
14Monthly Sales (from the 1st of each month up to and including the last day of each month.
15Jan '18Feb '18and so on.
16
17
18All the dates should be driven from data in row 2 (Daily Units Sold)
19
20
21
Sheet1
Cell Formulas
RangeFormula
C2:AA2C2=B2+1
B8:E8B8=SUM(CHOOSECOLS(TRANSPOSE(FILTER($B2:$AA4,($B2:$AA2>B7-7)*($B2:$AA2<=B7),"")),3))
 
Upvote 0
RobP, Thank you for replying. The first 7-day solution is perfect and does exactly what i want. Your help is greatly appreciated. Have a good day. I know i will, thanks to your good self.
 
Upvote 0
RobP, No one has joined in to assist. I would be grateful if you could provide solutions for the remaining two challenges. Thank you.
 
Upvote 0
Hi, I think this is about as close as I can get. Weekly / start / end of month formula is a bit brutal, and requires the user to enter the correct dates in order to function. Not managed to find a way to have a formula generate the correct dates at present, but if I do then I'll let you know sometime.

Cheers
Rob
weeklysales.xlsx
ABCDEFGHIJKLMNOPQRSTUVWXYZAAABACADAEAFAGAHAIAJ
1Daily Units Sold
2Product01/01/201802/01/201803/01/201804/01/201805/01/201806/01/201807/01/201808/01/201809/01/201810/01/201811/01/201812/01/201813/01/201814/01/201815/01/201816/01/201817/01/201818/01/201819/01/201820/01/201821/01/201822/01/201823/01/201824/01/201825/01/201826/01/201827/01/201828/01/201829/01/201830/01/201831/01/201801/02/201802/02/201803/02/201804/02/2018
3MonTueWedThuFriSatSunMonTueWedThuFriSatSunMonTueWedThuFnSatSunMonTueWedThuFnSatSunMonTueWedThuFnSatSun
4A150180216259311373448537300360432295355426511285342410281337404485249299358430516619485249299358430516516
5
6Weekly
707/01/201814/01/201821/01/201828/01/201804/02/2018
8A193727052570
9
10Weekly (from the 1st of each month up to and including Sunday of that week. The working week is from Monday to Sunday. The last week has to be up to the last day of the month even if the last week is only. say. a 4-day week)
1107/01/201814/01/201821/01/201828/01/201831/01/201807/02/2018
12A19372705257029561033
13
14Monthly Sales (from the 1st of each month up to and including the last day of each month.
1501/01/201801/02/2018
16A112011820
17
18All the dates should be driven from data in row 2 (Daily Units Sold)
19
20
21
Sheet1
Cell Formulas
RangeFormula
C2:AJ2C2=B2+1
B8:C8B8=SUM(CHOOSEROWS(FILTER($B2:$AJ4,($B2:$AJ2>B7-7)*($B2:$AJ2<=B7),""),3))
D8D8=SUM(CHOOSEROWS(FILTER($B2:$AI4,($B2:$AI2>D7-7)*($B2:$AI2<=D7),""),3))
C11:E11,G11C11=+B11+7
F11F11=+E11+3
B12:F12B12=LET(firstday,"01/"&MONTH(B11)&"/"&YEAR(B11),lastday,EOMONTH(firstday,0),thisweek,IF(B11-firstday<7,FILTER($B2:$AJ4,($B2:$AJ2>=B11-(B11-firstday))*($B2:$AJ2<=B11),""),IF(lastday-B11=0,FILTER($B2:$AJ4,($B2:$AJ2>A11)*($B2:$AJ2<=B11),""),FILTER($B2:$AJ4,($B2:$AJ2>(B11-7))*($B2:$AJ2<=B11),""))),result,SUM(CHOOSEROWS(thisweek,3)),result)
B16:C16B16=SUMPRODUCT($B4:$AJ4,(MONTH($B2:$AJ2)=MONTH(B15))*1)
 
Upvote 0
RobP, You've done more than i expected. I am very grateful for you help, and if we were in a pub I would be buying all evening. I wish you the best. Thank you! P.S. you've saved my bacon.
 
Upvote 0
Your Welcome

Thanks for your feedback … I’ll enjoy the virtual beer !

Rob
 
Upvote 0

Forum statistics

Threads
1,223,939
Messages
6,175,533
Members
452,652
Latest member
eduedu

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