Sandy Mann said:
Yours and Bob's formulas give the correct answer for the following year
for all dates including February 29. However, neither formula returns the
last day of the month of an extended range, (ie more than one year), . . .
Both Bob and I were addressing adding *ONE* and *ONLY* one year to the given
date. If you want to do something different, start a new discussion topic.
. . . if the starting date is February 29.
Or am I misunderstanding? Whatever, with
A1: 29 Feb 2004
A2: =A1+IF(MOD(YEAR(A1)+4,100)+(MOD(YEAR(A1)+4,400)=0),1461,2921)
Fill A2 down into A3:A100. Col A now contains all 29 Febs from 2004 to 2412.
Now enter
B1: =A1+366-(DAY(A1)<>DAY(A1+366))
and fill B1 down into B2:B100. Every cell in B1:B100 is 28 Feb of the
subsequent year, which is what Bob and I were trying to achieve. If you're
trying to achieve something else, I still can't figure out what you mean.
So what I was saying was that your formula did not return the last day of
February in the following leap year. . . .
Oh, you mean one year after, say, 28 Feb 2007 should be 29 Feb 2008? I don't
think so. Definitely not something I'd want if I were after one calendar
year later. But what the OP may want is up to the OP.
. . . My suggestion was therefore for the *SPECIFIC* case of a start date
of February 29 that would return the
correct last day of February when dragged along using the fill handle.
So you mean if there were a 29 Feb date in A1, a formula in A2 producing the
corresponding date in the next calendar year in A2, and if you drag A2 down
into A3:A5 the A5 cell should contain 29 Feb again even though A2:A4 contain
28 Feb dates?
If so, your formula fubars when the original date, the constant beginning
the sequence, is 28 Feb because it'll promote it to 29 Feb in leap years.
That is, if the first date were the constant 28 Feb 2006, your formula would
make the next date 28 Feb 2007, but it'd make the next date after that 29
Feb 2008. And if the first date were, say, 10 Jan 2006, the next date would
be 10 Jan 2007, but the date after that would be 11 Jan 2008.
Bob's formula and my formula would screw up one date every 4 years. Yours
would screw up 60 dates in the first 4 years, then compound the screw-up in
every 4 year cycle. Doesn't strike me as an improvement.