Function total_tap(STPRG_START, STPRG_END As Date) As Integer Dim nov, feb, may As Date Dim tap, x As Integer tap = 0 For x = 1995 To 2009 nov = DateValue("1/11/" & Str$(x)) feb = DateValue("1/2/" & Str$(x + 1)) may = DateValue("15/5/" & Str$(x + 1)) If STPRG_START <= nov And STPRG_END >= may Then tap = tap + 3 ElseIf STPRG_START <= nov And STPRG_END >= feb Then tap = tap + 2 ElseIf STPRG_START <= nov And STPRG_END >= nov Then tap = tap + 1 ElseIf STPRG_START <= feb And STPRG_END >= may Then tap = tap + 2 ElseIf STPRG_START <= feb And STPRG_END >= feb Then tap = tap + 1 ElseIf STPRG_START <= may And STPRG_END >= may Then tap = tap + 1 Else tap = tap End If Next x If tap = 0 Then tap = 1 total_tap = tap End Function Function current_tap(STPRG_START, STPRG_END As Date, acad) As Integer Dim nov, feb, may As Date If acad = "02/03" Then nov = DateValue("1/11/2002") feb = DateValue("1/2/2003") may = DateValue("15/5/2003") End If If acad = "03/04" Then nov = DateValue("1/11/2003") feb = DateValue("1/2/2004") may = DateValue("15/5/2004") End If If acad = "04/05" Then nov = DateValue("1/11/2004") feb = DateValue("1/2/2005") may = DateValue("15/5/2005") End If If acad = "05/06" Then nov = DateValue("1/11/2005") feb = DateValue("1/2/2006") may = DateValue("15/5/2006") End If If acad = "06/07" Then nov = DateValue("1/11/2006") feb = DateValue("1/2/2007") may = DateValue("15/5/2007") End If If acad = "07/08" Then nov = DateValue("1/11/2007") feb = DateValue("1/2/2008") may = DateValue("15/5/2008") End If If acad = "08/09" Then nov = DateValue("1/11/2008") feb = DateValue("1/2/2009") may = DateValue("15/5/2009") End If If STPRG_START <= nov And STPRG_END >= may Then current_tap = 3 ElseIf STPRG_START <= nov And STPRG_END >= feb Then current_tap = 2 ElseIf STPRG_START <= nov And STPRG_END >= nov Then current_tap = 1 ElseIf STPRG_START <= feb And STPRG_END >= may Then current_tap = 2 ElseIf STPRG_START <= feb And STPRG_END >= feb Then current_tap = 1 ElseIf STPRG_START <= may And STPRG_END >= may Then current_tap = 1 Else current_tap = 1 End If End Function