need a slicker way


M

mcnews

to do this:

....
ElseIf (Day(Date) > 12 And Month(Date) = 12 And Day(Date) < 18 And Month(Date) = 12) Then
Week = "49"
ElseIf (Day(Date) > 19 And Month(Date) = 12 And Day(Date) < 25 And Month(Date) = 12) Then
Week = "50"
ElseIf (Day(Date) > 26 And Month(Date) = 12 Or Day(Date) < 1 And Month(Date) = 1) Then
Week = "51"
ElseIf (Day(Date) > 2 And Month(Date) = 1 And Day(Date) < 8 And Month(Date) = 1) Then
Week = "52"
ElseIf (Day(Date) > 9 And Month(Date) = 1 And Day(Date) < 16 And Month(Date) = 1) Then
Week = "1"
ElseIf (Day(Date) > 16 And Month(Date) = 1 And Day(Date) < 23 And Month(Date) = 1) Then
Week = "2"
ElseIf (Day(Date) > 23 And Month(Date) = 1 Or Day(Date) < 30 And Month(Date) = 1) Then
Week = "3"
....
 
Ad

Advertisements

M

mcnews

Public Function FluWeek(ByVal sDate As Date) As String
Dim x As Integer
x = Int((CDate(sDate) - CDate("10/23/2011")) / 7) + 42
If x > 52 Then
x = x - 52
End If
FluWeek = Trim(Str(x))
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

Similar Threads


Top