View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Dana DeLouis[_5_] Dana DeLouis[_5_] is offline
external usenet poster
 
Posts: 77
Default DayOfYear Function?

If it's a programming solution you need, two possibilities could be:

Function DayOfYear(dte As Date) As Long
DayOfYear = dte - DateSerial(Year(dte), 1, 0)
' or...
DayOfYear = Format(dte, "y")
End Function

The second idea appears to be a "hair" faster, besides shorter.

--
Dana DeLouis
Using Windows XP & Office XP
= = = = = = = = = = = = = = = = =


"Dianne" wrote in message
...
Joe wrote:
Is there anyway to return the day number of the year. For example,
where 12/26/2003 would be = to 300.


With a simple formula, you could do something like this, assuming

12/26/2003
was in A1:

=A1-DATE(YEAR(A1),1,1)+1

--
Dianne