Okay, That way, the computer tells me it is a bad date. I didn't really look at your example's month and day, bacause the computer did not tell me it was bad. What happens if the code is inside a UDF and hits another non-leap year date? I knows there has got to be a case where this can happen, since the forumla for finding leap years has a 400 in it. (Not likely, but possible). I am not trying to start an debate on this, I just wanted to comment on since I hit the problem while lurking.
Have a great day.
Beth
>>PMFJI, but your example failed also, when you change the year, because of the leap year problem. I tried to change the year to the year that was stated in the begining of the thread (2018), and the date came back empty. So it is not fool-proof.
>>
>>>Sergey, the second is simpler,faster and it is the only solution;
>>>the first can fail:
>>>
>>>dob=DATE(2000,2,29)
>>>? DATE(YEAR(dob)-100, MONTH(dob), DAY(dob))
>>>? GOMONT(dob, -100*12)
>>>
>
>Beth, failed ?
>with DATE(2018,2,29) you start with a bad data, then any date computation with a empty date return a empty date;
>the likeable thing is that writing DATE(2018,2,29) you have applied the problem directly that I have described.
>
>
>* i have uses DATE(2000,2,29) because on Italian keyboard the {} are not presents
>* try this
>dob={^2018/2/29}
>? DATE(YEAR(dob)-100, MONTH(dob), DAY(dob))
>? GOMONT(dob, -100*12)
>
>
>Fabio