G
Guest
We have a database that records the ship date and receipt date and we are
trying to disregard weekends and holidays. The problem is that it only
disregards the first weekend and then the elseif is met and it quits. If a
transit goes over two weekends (for example, takes 14 calendar days in
transit), then only the first weekend is credited. How should the elseif
read? Here's what we have for January, for example:
Function IT(SDAY As Date, RDAY As Date)
If #12/24/2004# >= SDAY And #12/27/2004# <= RDAY Then
IT = ((RDAY - SDAY) - 4)
ElseIf #12/31/2004# >= SDAY And #1/3/2005# <= RDAY Then
IT = ((RDAY - SDAY) - 4)
ElseIf #1/8/2005# >= SDAY And #1/9/2005# <= RDAY Then
IT = ((RDAY - SDAY) - 2)
ElseIf #1/15/2005# >= SDAY And #1/16/2005# <= RDAY Then
IT = ((RDAY - SDAY) - 2)
ElseIf #1/22/2005# >= SDAY And #1/23/2005# <= RDAY Then
IT = ((RDAY - SDAY) - 2)
ElseIf #1/29/2005# >= SDAY And #1/30/2005# <= RDAY Then
IT = ((RDAY - SDAY) - 2)
Else: IT = RDAY - SDAY
End If
End Function
trying to disregard weekends and holidays. The problem is that it only
disregards the first weekend and then the elseif is met and it quits. If a
transit goes over two weekends (for example, takes 14 calendar days in
transit), then only the first weekend is credited. How should the elseif
read? Here's what we have for January, for example:
Function IT(SDAY As Date, RDAY As Date)
If #12/24/2004# >= SDAY And #12/27/2004# <= RDAY Then
IT = ((RDAY - SDAY) - 4)
ElseIf #12/31/2004# >= SDAY And #1/3/2005# <= RDAY Then
IT = ((RDAY - SDAY) - 4)
ElseIf #1/8/2005# >= SDAY And #1/9/2005# <= RDAY Then
IT = ((RDAY - SDAY) - 2)
ElseIf #1/15/2005# >= SDAY And #1/16/2005# <= RDAY Then
IT = ((RDAY - SDAY) - 2)
ElseIf #1/22/2005# >= SDAY And #1/23/2005# <= RDAY Then
IT = ((RDAY - SDAY) - 2)
ElseIf #1/29/2005# >= SDAY And #1/30/2005# <= RDAY Then
IT = ((RDAY - SDAY) - 2)
Else: IT = RDAY - SDAY
End If
End Function