Get Monday from Date column (Brainfog)

rsj88

New Member
Joined
Feb 20, 2018
Messages
38
Hi,

I had this before but i cant rem how i did it

Need a sql query to identify the week commencing date from the date column. any ideas?

Thanks
 

Excel Facts

Square and cube roots
The =SQRT(25) is a square root. For a cube root, use =125^(1/3). For a fourth root, use =625^(1/4).
Is this what you are looking for?
VBA Code:
' ----------------------------------------------------------------
' Procedure Name: getWeekStartMonday
' Purpose: Show the Date of the Monday of the week  where the parameter date exists
' Procedure Kind: Function
' Procedure Access: Public
' Parameter InDate (Date): A weekday
' Return Type: Date
' Author: Jack
' Date: 11-Jul-22
' Usage: 14-Jul-22 is a Thursday
'?getWeekStartMonday(#7-14-22#) 'to get Monday Date in the week containing 14-Jul-22
'11-Jul-22'Is the Monday
' ----------------------------------------------------------------
Function getWeekStartMonday(InDate As Date) As Date
    Dim wkDay As Date
    Select Case Weekday(InDate)
        Case 1 'Sun
            getWeekStartMonday = InDate + 1
        Case 2 'Mon
            getWeekStartMonday = InDate + 0
        Case 3 'Tue
            getWeekStartMonday = InDate - 1
        Case 4 'Wed
            getWeekStartMonday = InDate - 2
        Case 5 'Thu
            getWeekStartMonday = InDate - 3
        Case 6 'Fri
            getWeekStartMonday = InDate - 4
        Case 7 'Sat
            getWeekStartMonday = InDate - 5
    End Select
End Function
 
Upvote 0
Thanks mate.

ended up using this:

WeekCom: [ReceiptDate]+1-Weekday([ReceiptDate]+6)

Which also worked
 
Upvote 0

Forum statistics

Threads
1,221,519
Messages
6,160,285
Members
451,635
Latest member
nithchun

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