Wild Bill said:
Dave that's an intriguing solution. Interestingly, DATE falls apart,
easily seen with 1/1/2007 in A1 or =A1+DATE(0,0,3) or =A1+DATE(0,3,0)
and =A1+DATE(3,0,0).
The problem of course is that TIME is 0-based and DATE is 1900-based.
I don't think that it *falls apart* so much as it does not do what you think
that it is doing.
The problem with =A1+DATE(0,0,3) is that while there is a YEAR zero and a
DAY zero there was no MONTH zero in that year. The *zero* starting point is
=DATE(0,1,0) not =DATE(0,0,0). =DATE(0,0,3) would therefore be a negative
number which in the 1900 date system is illegal. =Month(0) is the month of
DAY zero not the month of YEAR zero. (DATE(1,0,3) is 1900-12-3 in the
internationa date system so if follows that =DATE(0,0,3) would be one year
before that presumably 1899-12-3)
=A1+DATE(0,3,0) and =A1+DATE(3,0,0) do what I would expect them to do:
=DATE(0,3,1) is 1900-3-1
=DATE(0,3,0) is therefore the day before that which is 1900-2-29
(because XL *thinks* the the year 1900 was a leap year)
It follows then that with 2007-8-20 in A1 then:
=A1+DATE(0,3,0) returns 2007-10-19 and
=A1+DATE(0,2,0) returns 200-9-20
Why the difference of a day? Because +DATE(0,3,0) is *NOT* adding three
months but is adding 60 DAYS because =DATE(0,3,0) is 1900-2-29 which is day
60. The date that you end up with will therefore depend on the number of
days that XL *thinks* were in that number of months in the year 1900 and the
number of days in the start month and consequent months.
The same principle applies to years.
You cannot successfully add months or years to a date and end up on the same
day of the month.
--
HTH
Sandy
In Perth, the ancient capital of Scotland
and the crowning place of kings
(e-mail address removed)
Replace @mailinator.com with @tiscali.co.uk