First Monday in the Year

lapta301

Well-known Member
Joined
Nov 12, 2004
Messages
1,001
Office Version
  1. 365
Platform
  1. Windows
Dear All

With the year in B4 (say 2014) could I trouble someone for a formula to show the first Monday in the year.

As ever my thanks
 

Excel Facts

Move date out one month or year
Use =EDATE(A2,1) for one month later. Use EDATE(A2,12) for one year later.
Hi cml19722000


With 2014 in B4 I'm getting 02/01/1905
 
Upvote 0
Hi,

You can also try below function prepared for you. Put it inside a module and use it as a excel formula from any cell.

=DayDate("Monday",2013,1,1)

You can also use the cell referrence like A1, B1 etc.


Code:
Function DayDate(DayToFind As String, yr As Integer, Mn As Integer, Dy As Integer) As String
    Dim Dt As Date
    Dim Dayy As String
    
    Dt = DateValue(yr & "/" & Mn & "/" & Dy)
    Dayy = Format(Dt, "DDDD")
    
    Do While Dayy <> DayToFind
    
    Dy = Dy + 1
    Dt = DateValue(yr & "/" & Mn & "/" & Dy)
    Dayy = Format(Dt, "DDDD")
    
    Loop
    
    DayDate = Format(Dt, "DD-MMM-YYYY")
End Function

Regards
taps
 
Upvote 0
Taps

Thank you that works a treat

Just in case someone asks for a different first day in a year could you explain to an idiot how this actually works.

Again my thanks
 
Upvote 0
Hi,

You are most welcome. :)
The above formula can be used to findout the first date of any days, any year and any month.

Just you need to change the day (Monday...Sunday etc.), the year and the month like below.

=DayDate("Friday",2014,2,1) will return back the first Friday in February in 2014.

Regards
taps
 
Upvote 0
taps

What a real idiot.

I was looking so intently at the code that I forgot the formula

Again my sincere thanks for a very versatile piece of code
 
Upvote 0
There are several ways with standard formula, here's one.
With your year in A2
Code:
=DATE(A2,1,1)+CHOOSE(WEEKDAY(DATE(A2,1,1),2),0,6,5,4,3,2,1)
 
Upvote 0

Forum statistics

Threads
1,214,388
Messages
6,119,227
Members
448,878
Latest member
Da9l87

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