Here is a WFM function that can be integrated into Excel or another program to calculate which fifth Saturday of the year it is. This is extremely useful for those using tables to schedule fifth Saturdays when scheduling rotating Saturday shifts.

The function takes a date as an argument and returns which fifth Saturday of the year it is. It will return 0 (not null) if the date is not a fifth Saturday. You can download a program to show the function working here or a text doc of the public function here.







Public Function findFifthSaturday(datSaturday As Date)
Dim bolSaturday As Boolean = False
Dim bolFifth As Boolean = False
Dim intSaturdays As Integer = 0
Dim datLoopingDate As Date = DateSerial(datSaturday.Year, 1, 1)
Dim intDays As Integer
datSaturday = DateSerial(datSaturday.Year, datSaturday.Month, datSaturday.Day)
If Weekday(datSaturday) = 7 Then
bolSaturday = True
End If
If datSaturday.Day > 28 Then
bolFifth = True
End If
intDays = DateDiff(DateInterval.Day, datLoopingDate, datSaturday)
If bolSaturday = True And bolFifth = True Then
For i As Integer = 1 To intDays
If DatePart(DateInterval.Weekday, datLoopingDate) = 7 Then
intSaturdays += 1
End If
datLoopingDate = DateAdd(“d”, 1, datLoopingDate)
intSaturdays = (intSaturdays Mod 4) + 1
intSaturdays = 0
End If
Return intSaturdays
End Function


One thought on “WFM Fifth Saturday Function”

  • kuliah bisnis manajemen says:

    I know this web site offers quality depending articles or reviews and additional data, is
    there any other web page which offers such things in quality?

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes:

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>