Finding first Monday in any year with VBA... With a caveat

RockandGrohl

Well-known Member
Joined
Aug 1, 2018
Messages
788
Office Version
  1. 2010
Platform
  1. Windows
Hello everyone, happy new year.

I'd like to have a report that generates all Week commencing dates vertically, which I'm fine with doing, but it needs to start on the week that contains the first days in January.
For example, in 2021 the first Monday was the 4th Jan, but for this purpose, the initial week commencing date is actually the 28th December 2019 as it contains days for January 1, 2 and 3.

Likewise, for 2022 it's December 27th as the Saturday & Sunday are January 1st and 2nd.

So does anyone have some VBA that can find the first week which has the first days of January in?

Thank you!
 

Excel Facts

Wildcard in VLOOKUP
Use =VLOOKUP("Apple*" to find apple, Apple, or applesauce
Hi

assuming I've understood correctly, and that a formula would work (rather than VBA), how about

=DATE(A2,1,1)-(WEEKDAY(DATE(A2,1,1))-2) - where A2 holds the relevant year (e.g. 2021, etc)

Hope it helps
 
Upvote 0

Forum statistics

Threads
1,214,516
Messages
6,119,980
Members
448,934
Latest member
audette89

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