How can I convert a date format to an ISO week format (in EXCEL)?

R

Ron Rosenfeld

You can use this UDF:

===============
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
=================

To enter it, <alt-F11> opens the VB Editor.

Ensure your project is highlighted in the Project Explorer window, then
Insert/Module and paste the code into the window that opens.

To use it:

=ISOWeeknum(date) will give the ISO compliant weeknumber for any date. 'date'
may be a cell reference.


--ron
 
Top