Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default DayOfYear Function?

Is there anyway to return the day number of the year. For example, where
12/26/2003 would be = to 300.


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default DayOfYear Function?

If you try with 1 in a cell and then format that cell to date, then you will
get day number 1. Count the number of days from that day until the day from
which you want to start and subtract that number from int(now()).

Ole

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




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 102
Default DayOfYear Function?

Joe,

This should work, say your date was in A1

=DATEDIF("2003/1/1",A1,"D") + 1

Dan E

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




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 107
Default DayOfYear Function?

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


  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 23
Default DayOfYear Function?

Hi Joe,

This function should do that:

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

--
Regards,

Jake Marx
MS MVP - Excel

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



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 620
Default DayOfYear Function?

Worksheet solution in response to your .misc query.

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

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




  #7   Report Post  
Posted to microsoft.public.excel.programming
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



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
copy of excel file not showing formulal/function in the function b oaallam Excel Discussion (Misc queries) 4 September 6th 07 01:20 PM
LINKEDRANGE function - a complement to the PULL function (for getting values from a closed workbook) [email protected] Excel Worksheet Functions 0 September 5th 06 03:44 PM
Emulate Index/Match combo function w/ VBA custom function Spencer Hutton Excel Worksheet Functions 2 May 2nd 05 05:26 PM
Excel should support DAYOFYEAR(year,month,day) returns julian dat. Neil Excel Worksheet Functions 1 February 24th 05 04:29 PM
User-Defined Function pre-empting Built-in Function? How to undo???? MarWun Excel Programming 1 August 6th 03 09:31 PM


All times are GMT +1. The time now is 07:33 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"