N
Norman Jones
Hi Shane,
Firstly, your formulae return incorrect results for leap years and also for
the year following any leap year.
You asked for a UDF to return the number of calendar days in a year. Try:
Function DIY(aDateCell)
If IsDate(aDateCell) Then
If year(aDateCell) Mod 4 = 0 Then
DIY = 366
Else
DIY = 365
End If
Else
DIY = CVErr(xlErrNA)
End If
End Function
However, a simpler, non-function method:
..the year has 365 days unless it is exactly divisble by four, when it has
366 days
---
Regards,
Norman
..
Firstly, your formulae return incorrect results for leap years and also for
the year following any leap year.
You asked for a UDF to return the number of calendar days in a year. Try:
Function DIY(aDateCell)
If IsDate(aDateCell) Then
If year(aDateCell) Mod 4 = 0 Then
DIY = 366
Else
DIY = 365
End If
Else
DIY = CVErr(xlErrNA)
End If
End Function
However, a simpler, non-function method:
..the year has 365 days unless it is exactly divisble by four, when it has
366 days
---
Regards,
Norman
..