How does one collate dates into Monday-Sunday ranges and sum up the data in 2nd Column to those date ranges

Rhothgar

Board Regular
Joined
Sep 24, 2013
Messages
53
Office Version
  1. 365
  2. 2021
Platform
  1. Windows
I am sure there will be a simple answer to this but I've been trying to research how to do this and have scratched my head for hours.

I know it's not Get Data>Combine Queries>Merge!

I have a dataset? called TSS and a date range (UK format - DD/MM/YYYY) of 01/01/2021 (This was a Friday) - 31/12/2021 (Also a Friday perchance!)

I would like to be able to quickly collate:-

01/01/2021 - 03/01/2021 then,
04/01/2021 - 10/01/2021 then
11/01/2021 - 17/01/2021 and so on and so forth but ending with
20/12/2021 - 26/12/2021 and
27/12/2021 - 31/12/2021

Technically, if this is too difficult I would be able to add in the preceding days before 01/01/2021 to make a full week's data and 01/01/2022 and 02/01/2022 to make a full week at the year end if it makes the job easier.

Then the data in the TSS column would need to sum up for those date ranges so I have the weekly TSS total.

I have created a basic chart. Ultimately, I would then like to compare it to 2022 data on the same graph so I can see whether more work was done in either year on any given week.

I attach a screenshot of part of the data to give a clearer idea of where I am. Obviously the screenshot shows individual days at present in terms of TSS not having been collated. It can even be in a bar chart format. I am not particularly concerned with how it looks if the chart I have chosen cannot handle what I am trying to achieve.

I have absolutely no idea about VBA or coding or whether that would be needed to achieve what I would like to see. I am only a basic Excel user unlike many of you incredibly clever bods!
 

Attachments

  • 1656763697699.png
    1656763697699.png
    165.8 KB · Views: 36
"The formula is total gobbledy-gook to me but what is the difference between your C2 and D2 formulas as they appear achieve the same result? Is it just another way of achieving what C2 does so that either could be used. I do not appear to need both."
The C and D are alternatives; choose the formula that you prefer. The Sumifs may be more efficient.
To help understand formulas and to help build formulas, try Excel's Formulas Formula Evaluate.

To have data to chart consider the following.

SumProduct 2022a.xlsm
GH
1Sum by week
2Sun 3-Jan-21220.47
3Sun 10-Jan-21193.22
4Sun 17-Jan-21350.00
5Sun 24-Jan-21145.00
6Sun 31-Jan-210.00
2b
Cell Formulas
RangeFormula
H2:H6H2=SUMIFS(B:B,A:A,"<="&G2,A:A,">="&G2-6)
Named Ranges
NameRefers ToCells
Dates='2b'!$A$2:$A$22H2:H6
TSS='2b'!$B$2:$B$22H2:H6
 
Upvote 0

Excel Facts

Links? Where??
If Excel says you have links but you can't find them, go to Formulas, Name Manager. Look for old links to dead workbooks & delete.
For chart data for a year (I have used 2021) as I understand it, you could try these. You only need to put the formula in F2 & G2 and the other results will automatically spill down the columns.
You just need to make the ranges (where I have used down to row 500) big enough to include all your data.

22 07 03.xlsm
ABEFG
1DatesTSSDatesWeek Sum
2Fri, 1-Jan-2158.35Sun, 3-Jan-21220.47
3Sat, 2-Jan-2159.22Sun, 10-Jan-21193.22
4Sun, 3-Jan-2191.28Sun, 17-Jan-21350.00
5Sun, 3-Jan-212.99Sun, 24-Jan-210.00
6Sun, 3-Jan-218.63Sun, 31-Jan-210.00
7Mon, 4-Jan-218.63Sun, 7-Feb-210.00
8Tue, 5-Jan-2126.67Sun, 14-Feb-210.00
9Wed, 6-Jan-2141.23Sun, 21-Feb-210.00
10Thu, 7-Jan-2141.69Sun, 28-Feb-210.00
11Fri, 8-Jan-2120.00Sun, 7-Mar-210.00
12Sat, 9-Jan-2125.00Sun, 14-Mar-210.00
13Sun, 10-Jan-2130.00Sun, 21-Mar-210.00
14Mon, 11-Jan-2135.00Sun, 28-Mar-210.00
15Tue, 12-Jan-2140.00Sun, 4-Apr-210.00
16Wed, 13-Jan-2145.00Sun, 11-Apr-210.00
17Thu, 14-Jan-2150.00Sun, 18-Apr-210.00
18Fri, 15-Jan-2155.00Sun, 25-Apr-210.00
19Sat, 16-Jan-2160.00Sun, 2-May-210.00
20Sun, 17-Jan-2165.00Sun, 9-May-210.00
21Sun, 16-May-210.00
22Sun, 23-May-210.00
Sum weeks
Cell Formulas
RangeFormula
F2:F53F2=SEQUENCE(52+(WEEKDAY(DATE(2021,1,1))=1),,DATE(2021,1,8)-WEEKDAY(DATE(2021,1,7)),7)
G2:G53G2=SUMIF(A2:A500,"<="&F2#,B2:B500)-SUMIF(A2:A500,"<"&F2#-6,B2:B500)
Dynamic array formulas.
 
Upvote 0

Forum statistics

Threads
1,223,247
Messages
6,171,007
Members
452,374
Latest member
keccles

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