Week number

wh00t

Registered User.
Local time
Today, 14:44
Joined
May 18, 2001
Messages
264
I currently use the following code to obtain the week number based on my companies financial year
Code:
Public Function FinancialYear(dDate As Date) As Integer
    FinancialYear = Year(dDate) - IIf(dDate < DateSerial(2003, 4, 27), 1, 0)
End Function


Public Function FinancialWeek(dDate As Date) As Integer
    FinancialWeek = (dDate - DateSerial(2003, 4, 27)) \ 7
End Function

but when it rolls over to the next year, the year start date has to be manually adjusted, is there any way that I can get access to automatically to revert back to week 1 after the 52 weeks are up instead of it going to 53+?
 
That's because you've altered the formula
Public Function FinancialYear(dDate As Date) As Integer
FinancialYear = Year(dDate) - IIf(dDate < DateSerial(Year(dDate), 4, 27), 1, 0)
End Function
 

Users who are viewing this thread

Back
Top Bottom