Help with elseif.....

  • Thread starter Thread starter Guest
  • Start date Start date
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top