View Single Post
  #15   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Ron Rosenfeld Ron Rosenfeld is offline
external usenet poster
 
Posts: 5,651
Default If a date range contains a leap year (date)

On Fri, 4 Jul 2008 21:33:33 -0400, "Rick Rothstein \(MVP - VB\)"
wrote:

Are you working in XL2007? Otherwise, if you are using an earlier version,
won't this...

ROW(INDIRECT(StartDate&":"&EndDate))

part of your formula require the evaluation of a row number greater than
65356 (in other words, past the end of the worksheet's last row) if the
EndDate is past 6/5/2079 (whose numerical value is 65356)?

Try this... put any valid date in A1 and 6/5/2079 in B1... put this formula
in any cell...

=SUMPRODUCT((MONTH(ROW(INDIRECT(A1&":"&B1)))=2)*( DAY(ROW(INDIRECT(A1&":"&B1)))=29))0

The result looks OK. Now add one day to the date in B1 (=6/62079)... I get a
#REF! error when I do that.

Rick


That's the difference -- I *am* using XL2007, so no error in that situation.

Hopefully, by the time the OP is using dates after 6/2/2079, she, too will be
using a version of Excel later than 2003 :-)

--ron