View Single Post
  #6   Report Post  
Posted to microsoft.public.excel.programming
Johnnyboy5[_2_] Johnnyboy5[_2_] is offline
external usenet poster
 
Posts: 99
Default Week numbers from an entered date

On Jun 18, 2:43*pm, "Vacuum Sealed" wrote:
Hi John

Reading from Chips site, I think this is what you're looking for...

ISO Week Number

Public Function IsoWeekNumber(InDate As Date) As Long
* * IsoWeekNumber = DatePart("ww", InDate, vbMonday, vbFirstFourDays)
End Function
Read carefully through the explaination and it will become clear...This
method uses the International Standards Organization (ISO) definition of a
week number.An ISO week always begins on a Monday, and ISO week 1 begins on
the Monday of the first week of the year that contains a Thursday.Said
differently, ISO week 1 is the first week (beginning on Monday) that has at
least four days.Note that it is possible that the first few days of a year
may fall into week 52 or week 53.Although this may seem quite counter
intuitive, it follows from the requirements first that all ISO weeks begin
on Monday,and second, that the first week must contain a Thursday.For
example, the year 2010 begins on Friday, 1-Jan-2010. Since this is later
than a Thursday (which is 7-Jan-2010),the week doesn't contains Thursday
(or, said another way,the week doesn't have at least four days), the ISO
week 1 begins on Monday, 4-January-2010.The day before the start of the
year, 31-December-2009, falls in ISO week 53 of the preceeding year,
2009.Rather than deal with the ambiguity of having a day that is in both
week 53 and week 0, the 53 carries through until 4-Jan-2010,which as noted
before is the Monday of the first week that contains a Thursday (or,
equivalently, the first week with four or more days).HTHMick....


Thanks - I will also give that a try out.

Johnnboy