7 Replies Latest reply on Aug 25, 2010 4:32 AM by travelclub

# Formula for age

### Title

Formula for age

### Post

FileMaker5

I have two date fields:

date_born

date_died

I want to calculate the age (number of years) between the two dates.

How would the formula look like?

Guenter

• ###### 1. Re: Formula for age

Year ( date_died - date_born ) - 1

Set the calculation result to "Number".

Nick

• ###### 2. Re: Formula for age

Try calculation (result is number):

Case ( date_born and date_died ; Year ( date_died ) - Year ( date_born )  )

• ###### 3. Re: Formula for age

I like your calc better, Nick.  But I would add the boolean test that both fields must have a value or you get wonkie/invalid results.

• ###### 4. Re: Formula for age

>  I would add the boolean test that both fields must have a value or you get wonkie/invalid results

Good point. Combining your boolean test and my calc will produce a good solution:

Case ( date_born and date_died ; Year ( date_died - date_born ) - 1 )

Nick

• ###### 5. Re: Formula for age

A person was born on 21-6-1946.

If he died on 21-6-2010 the age should show 64 years.

If he died on 20-6-2010 the age should show 63 years.

• ###### 6. Re: Formula for age

Ok, the following calc should account for those unlucky enough to die on their birthday!

Case ( date_born and date_died ; Year ( date_died ) - Year ( date_born ) - ( DayOfYear ( date_died ) < DayOfYear ( date_born ) ) )

• ###### 7. Re: Formula for age

Thank you sun, moon & star!

Your formula works fine. It shows the age of a person on the day he died.

Thanks to all others who participated in the discussion.