On Sat, 19 Feb 2005 23:15:07 +1300, "gregork" wrote:
If I enter a week number in a cell I want to have a formula that returns
the end date for that date (based on ISO week
numbers)
GK
You can do that with a UDF.
To enter this UDF, <alt-F11 opens the
VB Editor.
Ensure your project is highlighted in the project explorer window, then
Insert/Module and paste the code below into the window that opens.
Use this by entering the formula =ISOWeeknum(dt) where dt is either a date or a
cell reference containing a date.
=================================
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