Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Sundays in a given period 1

Status
Not open for further replies.

cairo207

IS-IT--Management
Jan 2, 2003
13
How do I count the number of sundays in a given period?
Also if the start date is a subday, the formula should count that sunday, and, if the end date is a sunday, the formula should not count that sunday.
 
this will check for sundays between dates
Code:
Function GetSundays(Date1 As Date, date2 As Date)
Dim x As Date
Dim y As Integer
y = 0

For x = Date1 To date2
If Weekday(x) = 1 Then y = y + 1
Next x
GetSundays = y

End Function

you would use
Code:
getsundays(datelogged,dateclosed)


Hope this is of use, Rob.[yoda]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top