View Single Post
  #11   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Rick Rothstein \(MVP - VB\)[_813_] Rick Rothstein \(MVP - VB\)[_813_] is offline
external usenet poster
 
Posts: 1
Default If a date range contains a leap year (date)

I need to identify whether a date range contains a leap year day - 2/29.
I
have a start date and end date and leap year True/False indicator

Start Date 01/01/08 01/01/08 03/31/08 06/30/07

End Date 12/31/08 06/30/08 12/31/08 03/01/08

Leap Year? TRUE TRUE FALSE TRUE

I can say that the range must be (will be) less than or equal to 365/366.


Slight error. Formula should be:

=SUMPRODUCT((MONTH(ROW(INDIRECT(StartDate&":"&EndD ate)))=2)*
(DAY(ROW(INDIRECT(StartDate&":"&EndDate)))=29))0

The SUMPRODUCT function returns the number of Feb 29's from StartDate to
EndDate inclusive.


I like this approach! And it works for the expected ranges the OP has
indicated it will needed for; but, of course, it will not work in the
general case if the EndDate is greater than 6/5/2079.<g

Rick