Return the First Date (Sunday) and Last Date (Saturday) EASY Help!

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hello All,

Can someone give me the formula to return the first date
of the week and last date of the week from a given date.
Example:

MyDate="11/21/2003"
Formula return = "11/16/2003 - 11/22/2003"

thnx.
 
Good afternoon

These two functions will give you your required dates.

Maurice



Function StartOfWeek(D As Variant, Optional FirstWeekday As Integer) As Variant
'
' Returns the date representing the first day of the current week.
'
' Arguments:
' D = Date
' FirstWeekday = (Optional argument) Integer that represents the first
' day of the week (e.g., 1=Sun..7=Sat).
'
If IsMissing(FirstWeekday) Then 'Sunday is the assumed first day of week.
StartOfWeek = D - WeekDay(D) + 1
Else
StartOfWeek = D - WeekDay(D, FirstWeekday) + 1
End If
End Function

==========================
Function EndOfWeek(D As Variant, Optional FirstWeekday As Integer) As Variant
'
' Returns the date representing the last day of the current week.
'
' Arguments:
' D = Date
' FirstWeekday = (Optional argument) Integer that represents the first
' day of the week (e.g., 1=Sun..7=Sat).
'
If IsMissing(FirstWeekday) Then 'Sunday is the assumed first day of week.
EndOfWeek = D - WeekDay(D) + 7
Else
EndOfWeek = D - WeekDay(D, FirstWeekday) + 7
End If
End Function






Can someone give me the formula to return the first date
of the week and last date of the week from a given date.
==========================
 
Back
Top