D
david p
ISO standard says Jan. 3, 2005 is week 1 day 1. Excel says
it is week 2 day 1.
it is week 2 day 1.
To get the weeknumber for ISO compliance use:
Function ISOWEEKNUM(d1 As Date)
'Laurent Longre function
Dim Test As Long
Test = DateSerial(Year(d1), Month(d1), Day(d1))
If Test <= 0 Or Test > 401769 Then
ISOWEEKNUM = CVErr(xlErrNA)
Exit Function
End If
Dim d2 As Long
d2 = DateSerial(Year(d1 - WeekDay(d1 - 1) + 4), 1, 3)
ISOWEEKNUM = Int((d1 - d2 + WeekDay(d2) + 5) / 7)
End Function
Hi Ron!
Can you modify the approach?
Your:
=ISOWEEKNUM("29-Dec-2003")
Returns 53 which is not right.
29-Dec-2003 was ISO Week 1; it was the Monday of the week containing 4-Jan /
the Monday of the week with the first Thursday in the calendar year.
Also you have a week 53 with only 1 day whereas all ISO weeks have 7 days.
And Week 1 has only 6 days.