![]() |
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. |
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. |
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. |
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. |
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. |
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 |
All times are GMT +1. The time now is 12:54 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com