Date Calculation

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

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.
 
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
 
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
 
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
 
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
 
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Leap Year 7
Disable a range of Cells 1
Incorrect Date function 6
Current Run Rate 6
Formula for selecting a Leap Year. 7
Error in Excel date calculations 3
IIF statement as criteria 2
Excel Forecasting Dates Out to the Day 3

Back
Top