Benss
Benss

Reputation: 315

How to find the start date of week from a given date?

I have a concern is that I want from a given date to retrieve the start date of the week for example: 15/04/2015 So the beginning of the week will: 13/04/2015 (for me the beginning of the week is Monday).

thanks

Upvotes: 5

Views: 19497

Answers (2)

daniele3004
daniele3004

Reputation: 13920

Try this :-)

Dim FirstDayInWeek, LastDayInWeek  As Variant
Dim dtmDate As Date
dtmDate = "15/04/2015"

The begin date of week:

FirstDayInWeek = dtmDate - Weekday(dtmDate, vbUseSystem) + 1
MsgBox FirstDayInWeek

The end date of Week

LastDayInWeek = dtmDate - Weekday(dtmDate, vbUseSystem) + 7
MsgBox LastDayInWeek

Upvotes: 8

Ankit Bajpai
Ankit Bajpai

Reputation: 13509

Try this Formula:-

=A1-WEEKDAY(A1,2)+1

Where A1 contains your Input Date.

Upvotes: 2

Related Questions