View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.misc
JC
 
Posts: n/a
Default Birthday calculations

Hi Niek,

It took a little while to puzzle your formula out but I now understand it. Many
thanks for your assistance.

I ran a few tests and found that it gives the correct answer if both birthdate
and today() are in non leap years, if both birthdate and today() are in leap
years or when the birthdate is in a non leap year and today() is a leap year.

When the birthdate is in a leap year and today() is in a non leap year it is
still giving correct answers except when the birthdate is 29th February. If
the birthdate is 29th February it calculates as if the non leap year birthday is
1st March. Thus on the 25th February, 2006 for a 29th February 1996 birthdate
it calculates that the next birthday will be in 4 days time.

I now understand what you meant when you wrote "Works OK for leap years,
depending on what your definition is of the birthdays in non-leap years for
those born on Feb. 29".

I have no experience with this - are birthdays for those born on 29th February
celebrated on 28th February or 1st March in non leap years?

JC


On Sat, 25 Feb 2006 10:49:14 +0100, "Niek Otten" wrote:

=DATE(YEAR(TODAY())+IF(TEXT(TODAY(),"mmdd")TEXT( C3,"mmdd"),1,0),MONTH(C3),DAY(C3))-TODAY()

Works OK for leap years, depending on what your definition is of the
birthdays in non-leap years for those born on Feb. 29


"JC" wrote in message
...
Hi,

I am setting up a spreadsheet to calculate people's age and the number of
days to their next birthday. Calculating their age I can do but calculating
the number of days until their next birthday is proving a little difficult.

I am currently using the formula =365-DATEDIF($C3,TODAY(),"yd") where the
full dd/mm/yyyy birth date is in c3.

It occurred to me that the formula will be correct for non leap years but
will probably be one day out on leap years.

I would welcome any suggestions on how to correct the above formula to
compensate for leap years?