Can anyone tell me why Microsofts =weeknum() function does not agree with my
calendar. Excel tells me 22/06/05 is week 26, my Calendar and Diary tell me
it is week 25.
Is there a fix for this or how should I handle it?
TIA Mark
Your calendar and Microsoft are using different week numbering conventions.
See HELP for the convention used by the Microsoft function.
Your calendar may be using the ISO weeknumbering function. If that is the
case, you may use this UDF: =ISOWEEKNUM(date)
To use the UDF you must enter it into a VBA module.
<alt><F11> opens the VB editor.
Insert/Module and paste the code below into the window that opens.
======================
Function ISOWeeknum(dt As Date) As Integer
ISOWeeknum = DatePart("ww", dt, vbMonday, vbFirstFourDays)
If ISOWeeknum > 52 Then
If DatePart("ww", dt + 7, vbMonday, vbFirstFourDays) = 2 Then
ISOWeeknum = 1
End If
End If
End Function
====================
--ron