#1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 1
Default Date Calculation

I would like to calculate the number of days within a span of years without
February 29th. In other words, I don't want to recognize the 29th day of
February within leap years.
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 15,768
Default Date Calculation

Do you have a start date and an end date?

A1 = start date = 1/1/1986
B1 = end date = 1/1/2007

=B1-A1-SUMPRODUCT(--(MONTH(DATE(ROW(INDIRECT(YEAR(A1)&":"&YEAR(B1))),2 ,29))=2))

I'm sure there's a nice short algorithm for determining leap years based on
year.....but I don't know what it is! I've read it somewhere.

Biff

"LeapYear" wrote in message
...
I would like to calculate the number of days within a span of years without
February 29th. In other words, I don't want to recognize the 29th day of
February within leap years.



  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 15,768
Default Date Calculation

P.S.

Format the cell as GENERAL

I'm sure there's a nice short algorithm for determining leap years based on
year


There's more to it than just finding years divisable by 4.

Biff

"T. Valko" wrote in message
...
Do you have a start date and an end date?

A1 = start date = 1/1/1986
B1 = end date = 1/1/2007

=B1-A1-SUMPRODUCT(--(MONTH(DATE(ROW(INDIRECT(YEAR(A1)&":"&YEAR(B1))),2 ,29))=2))

I'm sure there's a nice short algorithm for determining leap years based
on year.....but I don't know what it is! I've read it somewhere.

Biff

"LeapYear" wrote in message
...
I would like to calculate the number of days within a span of years
without
February 29th. In other words, I don't want to recognize the 29th day of
February within leap years.





  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 15,768
Default Date Calculation

Ooops!

Disregard that formula. I don't take into account the full start, end dates
for the leap year. Back to the drawing board! I have to step out for a few
hours. If there are no other solutions I'll come up with something when I
return.

Biff

"T. Valko" wrote in message
...
Do you have a start date and an end date?

A1 = start date = 1/1/1986
B1 = end date = 1/1/2007

=B1-A1-SUMPRODUCT(--(MONTH(DATE(ROW(INDIRECT(YEAR(A1)&":"&YEAR(B1))),2 ,29))=2))

I'm sure there's a nice short algorithm for determining leap years based
on year.....but I don't know what it is! I've read it somewhere.

Biff

"LeapYear" wrote in message
...
I would like to calculate the number of days within a span of years
without
February 29th. In other words, I don't want to recognize the 29th day of
February within leap years.





  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 15,768
Default Date Calculation

OK, try this:

A1 = start date
B1 = end date

=SUMPRODUCT(--(TEXT(ROW(INDIRECT(A1&":"&B1)),"mdd")<"229"))

Instead of counting how many leap days are in the range and subtracting we
can just count how many days *are not* leap days.

Biff

"T. Valko" wrote in message
...
Ooops!

Disregard that formula. I don't take into account the full start, end
dates for the leap year. Back to the drawing board! I have to step out for
a few hours. If there are no other solutions I'll come up with something
when I return.

Biff

"T. Valko" wrote in message
...
Do you have a start date and an end date?

A1 = start date = 1/1/1986
B1 = end date = 1/1/2007

=B1-A1-SUMPRODUCT(--(MONTH(DATE(ROW(INDIRECT(YEAR(A1)&":"&YEAR(B1))),2 ,29))=2))

I'm sure there's a nice short algorithm for determining leap years based
on year.....but I don't know what it is! I've read it somewhere.

Biff

"LeapYear" wrote in message
...
I would like to calculate the number of days within a span of years
without
February 29th. In other words, I don't want to recognize the 29th day
of
February within leap years.









  #6   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 5,651
Default Date Calculation

On Tue, 29 May 2007 14:27:25 -0700, LeapYear
wrote:

I would like to calculate the number of days within a span of years without
February 29th. In other words, I don't want to recognize the 29th day of
February within leap years.


Try this:

=A2-A1-SUMPRODUCT((MONTH(ROW(INDIRECT(A1&":"&A2)))=2)*
(DAY(ROW(INDIRECT(A1&":"&A2)))=29))


--ron
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
Date calculation Funkyfido Excel Worksheet Functions 3 March 22nd 07 10:04 AM
Tricky Date calculation: How to calculate a future date [email protected] Excel Discussion (Misc queries) 9 August 11th 06 04:24 AM
Date Calculation Steve New Users to Excel 4 August 3rd 06 06:15 PM
Date calculation MIchel Khennafi Excel Worksheet Functions 3 April 27th 06 07:35 PM
Due Date Calculation? Randy New Users to Excel 11 July 14th 05 07:44 PM


All times are GMT +1. The time now is 06:02 AM.

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

About Us

"It's about Microsoft Excel"