Date formula by week

lost_in_the_sauce

Board Regular
Joined
Jan 18, 2021
Messages
128
Office Version
  1. 365
Platform
  1. Windows
One of our forecasting models needs an overhaul and the current system breaks monthly expenses by category down weekly except it needs an end value for each month, so it throws some weeks off.

Example:
Week 1 Jan1-7
Week 2 Jan 8-14
Week 3 Jan 15-21
Week 4 Jan 22-28
Week 5 Jan 29-31 (report)
Week 6 Feb 1-4
Week 7 Feb 5-12
etc

I'm swapping it to a daily breakout to try and smooth the variances between weeks out but I'm trying to create a formula for which week to pull an expense amount from before dividing it by the days in that week, so that if cell A1 has 1/1/2021, cell B1 has 1/2/2021, cell C1 has 1/3/2021, etc - then the cells directly below in row 2 would have 1/1/2021 though 1/1/2021 and then 1/14/2021 for the next 7, etc (end of week dating for expenses).
 

Excel Facts

Format cells as currency
Select range and press Ctrl+Shift+4 to format cells as currency. (Shift 4 is the $ sign).
I might do something using this:
MrExcelPlayground4.xlsx
ABCDEFG
1Week NumberStartFinishText
211/1/20211/7/2021Week 1 Jan 1 - 71/1/2021Week 1 Jan 1 - 7
321/8/20211/14/2021Week 2 Jan 8 - 141/2/2021Week 1 Jan 1 - 7
431/15/20211/21/2021Week 3 Jan 15 - 211/3/2021Week 1 Jan 1 - 7
541/22/20211/28/2021Week 4 Jan 22 - 281/4/2021Week 1 Jan 1 - 7
651/29/20211/31/2021Week 5 Jan 29 - 311/5/2021Week 1 Jan 1 - 7
762/1/20212/4/2021Week 6 Feb 1 - 41/6/2021Week 1 Jan 1 - 7
872/5/20212/11/2021Week 7 Feb 5 - 111/7/2021Week 1 Jan 1 - 7
982/12/20212/18/2021Week 8 Feb 12 - 181/8/2021Week 2 Jan 8 - 14
1092/19/20212/25/2021Week 9 Feb 19 - 251/9/2021Week 2 Jan 8 - 14
11102/26/20212/28/2021Week 10 Feb 26 - 281/10/2021Week 2 Jan 8 - 14
12113/1/20213/4/2021Week 11 Mar 1 - 41/11/2021Week 2 Jan 8 - 14
13123/5/20213/11/2021Week 12 Mar 5 - 111/12/2021Week 2 Jan 8 - 14
14133/12/20213/18/2021Week 13 Mar 12 - 181/13/2021Week 2 Jan 8 - 14
15143/19/20213/25/2021Week 14 Mar 19 - 251/14/2021Week 2 Jan 8 - 14
16153/26/20213/31/2021Week 15 Mar 26 - 311/15/2021Week 3 Jan 15 - 21
17164/1/20214/1/2021Week 16 Apr 1 - 11/16/2021Week 3 Jan 15 - 21
18174/2/20214/8/2021Week 17 Apr 2 - 81/17/2021Week 3 Jan 15 - 21
19184/9/20214/15/2021Week 18 Apr 9 - 151/18/2021Week 3 Jan 15 - 21
20194/16/20214/22/2021Week 19 Apr 16 - 221/19/2021Week 3 Jan 15 - 21
21204/23/20214/29/2021Week 20 Apr 23 - 291/20/2021Week 3 Jan 15 - 21
22214/30/20214/30/2021Week 21 Apr 30 - 301/21/2021Week 3 Jan 15 - 21
23225/1/20215/6/2021Week 22 May 1 - 61/22/2021Week 4 Jan 22 - 28
24235/7/20215/13/2021Week 23 May 7 - 131/23/2021Week 4 Jan 22 - 28
25245/14/20215/20/2021Week 24 May 14 - 201/24/2021Week 4 Jan 22 - 28
26255/21/20215/27/2021Week 25 May 21 - 271/25/2021Week 4 Jan 22 - 28
27265/28/20215/31/2021Week 26 May 28 - 311/26/2021Week 4 Jan 22 - 28
28276/1/20216/3/2021Week 27 Jun 1 - 31/27/2021Week 4 Jan 22 - 28
29286/4/20216/10/2021Week 28 Jun 4 - 101/28/2021Week 4 Jan 22 - 28
30296/11/20216/17/2021Week 29 Jun 11 - 171/29/2021Week 5 Jan 29 - 31
31306/18/20216/24/2021Week 30 Jun 18 - 241/30/2021Week 5 Jan 29 - 31
32316/25/20216/30/2021Week 31 Jun 25 - 301/31/2021Week 5 Jan 29 - 31
33327/1/20217/1/2021Week 32 Jul 1 - 12/1/2021Week 6 Feb 1 - 4
34337/2/20217/8/2021Week 33 Jul 2 - 82/2/2021Week 6 Feb 1 - 4
35347/9/20217/15/2021Week 34 Jul 9 - 152/3/2021Week 6 Feb 1 - 4
36357/16/20217/22/2021Week 35 Jul 16 - 222/4/2021Week 6 Feb 1 - 4
37367/23/20217/29/2021Week 36 Jul 23 - 292/5/2021Week 7 Feb 5 - 11
38377/30/20217/31/2021Week 37 Jul 30 - 312/6/2021Week 7 Feb 5 - 11
39388/1/20218/5/2021Week 38 Aug 1 - 52/7/2021Week 7 Feb 5 - 11
40398/6/20218/12/2021Week 39 Aug 6 - 122/8/2021Week 7 Feb 5 - 11
41408/13/20218/19/2021Week 40 Aug 13 - 19
42418/20/20218/26/2021Week 41 Aug 20 - 26
43428/27/20218/31/2021Week 42 Aug 27 - 31
44439/1/20219/2/2021Week 43 Sep 1 - 2
45449/3/20219/9/2021Week 44 Sep 3 - 9
46459/10/20219/16/2021Week 45 Sep 10 - 16
47469/17/20219/23/2021Week 46 Sep 17 - 23
48479/24/20219/30/2021Week 47 Sep 24 - 30
494810/1/202110/7/2021Week 48 Oct 1 - 7
504910/8/202110/14/2021Week 49 Oct 8 - 14
515010/15/202110/21/2021Week 50 Oct 15 - 21
525110/22/202110/28/2021Week 51 Oct 22 - 28
535210/29/202110/31/2021Week 52 Oct 29 - 31
545311/1/202111/4/2021Week 53 Nov 1 - 4
555411/5/202111/11/2021Week 54 Nov 5 - 11
565511/12/202111/18/2021Week 55 Nov 12 - 18
575611/19/202111/25/2021Week 56 Nov 19 - 25
585711/26/202111/30/2021Week 57 Nov 26 - 30
595812/1/202112/2/2021Week 58 Dec 1 - 2
605912/3/202112/9/2021Week 59 Dec 3 - 9
616012/10/202112/16/2021Week 60 Dec 10 - 16
626112/17/202112/23/2021Week 61 Dec 17 - 23
636212/24/202112/30/2021Week 62 Dec 24 - 30
646312/31/202112/31/2021Week 63 Dec 31 - 31
Sheet8
Cell Formulas
RangeFormula
C2C2=IF(B2+6>EOMONTH(B2,0),EOMONTH(B2,0),B2+6)
D2:D64D2="Week " & A2&" "& TEXT(B2,"mmm ")&DAY(B2)& " - "&DAY(C2)
A3:A64A3=A2+1
B3:B64B3=C2+1
C3:C64C3=IF(B3+6>EOMONTH(B3,0),EOMONTH(B3,0),B3+IF(MOD(C2-$B$2,7)=6,6,5-MOD(C2-$B$2,7)))
G2:G40G2=INDEX($D$2:$D$64,MATCH(F2,$B$2:$B$64,1))
 
Upvote 0
Solution
Have a follow up if you don't mind - just because of the formatting the data gets sent to me in, I swapped the rows and columns, but I'm getting an issue where if the day is the last day, I get a week with 1 day - if you continue your formula in column G down, you might run into it for April.
 
Upvote 0
There are definitely some 1-day 'weeks'. What would you prefer it to be?
 
Upvote 0

Forum statistics

Threads
1,214,904
Messages
6,122,169
Members
449,070
Latest member
webster33

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