List of week's first day but split when one week reach the end of a month

Shiro26

Board Regular
Joined
Oct 2, 2015
Messages
82
Hi

I'm trying to list the dates that represent the begining of each week of the year but, when a week has two months, I would like to split it.
I do not want to use vba to do that, just a single formula.

The bold+underline cell in the table below is the starting date.
In the second line and below, the following formula is typed:
=IF(WEEKDAY(R[-1]C,2)=1,R[-1]C+7,R[-1]C-WEEKDAY(R[-1]C)+9)

Although I've tried few options, I wasn't able to add in the above formula the part that is needed to return the cells in bold only.

Does anyone know how to do that?

Thank you very much in advance for your help.

Shiro.


<tbody>
Tuesday
01 Aug 13Tuesday01 Aug 13
Monday
07 Aug 13
Monday07 Aug 13
Monday14 Aug 13
Monday14 Aug 13
Monday21 Aug 13Monday21 Aug 13
Monday28 Aug 13Monday28 Aug 13
Monday04 Sep 13Monday04 Sep 13
Monday11 Sep 13Monday11 Sep 13
Monday18 Sep 13Monday18 Sep 13
Monday25 Sep 13Monday25 Sep 13
Monday02 Oct 13Sunday
1 Oct 13
Monday09 Oct 13Monday02 Oct 13
Monday16 Oct 13Monday09 Oct 13
Monday23 Oct 13Monday16 Oct 13
Monday30 Oct 13Monday23 Oct 13
Monday06 Nov 13Monday30 Oct 13
Monday13 Nov 13Wednesday
1 Nov 2013
Monday06 Nov 13
Monday13 Nov 13

<colgroup><col span="3"><col><col></colgroup><tbody>
</tbody>
</tbody>
 

Excel Facts

Whats the difference between CONCAT and CONCATENATE?
The newer CONCAT function can reference a range of cells. =CONCATENATE(A1,A2,A3,A4,A5) becomes =CONCAT(A1:A5)
Hi,

table? Bold?
Surely you forgot to add something to this?

Hi

I apologize, I had added a table but it seemed it did not show up correctly...
It looks like i have some troubles putting the table...
thank you for pointing this out.

Turning this01 Aug 13 (Tue)
07 Aug 13 (Mon)
14 Aug 13 (Mon)
21 Aug 13 (Mon)
28 Aug 13 (Mon)
04 Sep 13 (Mon)
11 Sep 13 (Mon)
18 Sep 13 (Mon)
25 Sep 13 (Mon)
02 Oct 13 (Mon)
09 Oct 13 (Mon)
16 Oct 13 (Mon)
23 Oct 13 (Mon)
30 Oct 13 (Mon)
06 Nov 13 (Mon)
13 Nov 13 (Mon)

Into that
01 Aug 13 (Tue)
07 Aug 13 (Mon)
14 Aug 13 (Mon)
21 Aug 13 (Mon)
28 Aug 13 (Mon)
01 Sep 13 (Fri)
04 Sep 13 (Mon)
11 Sep 13 (Mon)
18 Sep 13 (Mon)
25 Sep 13 (Mon)
01 Oct 13 (Sun)
09 Oct 13 (Mon)
16 Oct 13 (Mon)
23 Oct 13 (Mon)
30 Oct 13 (Mon)
01 Nov 13 (Wed)
06 Nov 13 (Mon)
13 Nov 13 (Mon)
20 Nov 13 (Mon)
27 Nov 13 (Mon)
01 Dec 13 (Fri)




Also, I have just managed to do it using the formula (it took me quite some time to figure out out to write it haha):
=IF(WEEKDAY(R[-1]C,2)<>1,R[-1]C-WEEKDAY(R[-1]C)+9,IF(MONTH(R[-1]C)<>MONTH(R[-1]C+7),EOMONTH(R[-1]C,0)+1,R[-1]C+7))
 
Last edited:
Upvote 0
Hmm, think you missed something.
take a look at this:


Book1
ABC
101 Aug 13 (Tue)01 Aug 2013 (Thu)
207 Aug 13 (Mon)05 Aug 2013 (Mon)
314 Aug 13 (Mon)12 Aug 2013 (Mon)
421 Aug 13 (Mon)19 Aug 2013 (Mon)
528 Aug 13 (Mon)26 Aug 2013 (Mon)
601 Sep 13 (Fri)01 Sep 2013 (Sun)
704 Sep 13 (Mon)02 Sep 2013 (Mon)
811 Sep 13 (Mon)09 Sep 2013 (Mon)
918 Sep 13 (Mon)16 Sep 2013 (Mon)
1025 Sep 13 (Mon)23 Sep 2013 (Mon)
1101 Oct 13 (Sun)30 Sep 2013 (Mon)
1209 Oct 13 (Mon)01 Oct 2013 (Tue)
1316 Oct 13 (Mon)07 Oct 2013 (Mon)
1423 Oct 13 (Mon)14 Oct 2013 (Mon)
1530 Oct 13 (Mon)21 Oct 2013 (Mon)
1601 Nov 13 (Wed)28 Oct 2013 (Mon)
1706 Nov 13 (Mon)01 Nov 2013 (Fri)
1813 Nov 13 (Mon)04 Nov 2013 (Mon)
1920 Nov 13 (Mon)11 Nov 2013 (Mon)
2027 Nov 13 (Mon)18 Nov 2013 (Mon)
2101 Dec 13 (Fri)25 Nov 2013 (Mon)
2201 Dec 2013 (Sun)
Sheet1
Cell Formulas
RangeFormula
C2=IF(MONTH(C1+(7-WEEKDAY(C1,2)+1))>MONTH(C1),EOMONTH(C1,0)+1,C1+(7-WEEKDAY(C1,2)+1))
 
Upvote 0
Hello Joris,

I apologize, I realized after reading your post that you thought it was year 2013, which is totally understandable.
However, I had put a random number and the year of my example was 2113...

Both formulas below seems to be working but after checking, yours does not handle the change of year.

=IF(AND(WEEKDAY(R[-1]C,2)>1,WEEKDAY(R[-1]C,2)<7),R[-1]C+8-WEEKDAY(R[-1]C,2),IF(WEEKDAY(R[-1]C,2)=7,R[-1]C+1,IF(MONTH(R[-1]C)<>MONTH(R[-1]C+7),EOMONTH(R[-1]C,0)+1,R[-1]C+7)))

=IF(MONTH(R[-1]C+(7-WEEKDAY(R[-1]C,2)+1))>MONTH(R[-1]C),EOMONTH(R[-1]C,0)+1,R[-1]C+(7-WEEKDAY(R[-1]C,2)+1))

To be honest, I had tried to go with the same logic as yous but could not figure out the problem in my attempts, there must be an additional thing to do in your formula to make it pass the barrier of December 31st..

I still thank you for your formula because if the work is necessary within the year it is more understandable.

Thank you for taking the time to help me.

I will mark the post as solved.

Have a great rest of your day.

Shiro
 
Last edited:
Upvote 0
Hi Shiro,

Issue of a year change is easily fixed by changing the formula to this:
=IF(MONTH(C1+(7-WEEKDAY(C1,2)+1))<>MONTH(C1),EOMONTH(C1,0)+1,C1+(7-WEEKDAY(C1,2)+1))
 
Upvote 0

Forum statistics

Threads
1,214,885
Messages
6,122,090
Members
449,065
Latest member
Danger_SF

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