Salesforce and other SMB Solutions are coming soon. ×

# Age Calculation - For the Thoroughly Confused, Please?

## Recommended Posts

Hi all,

I've read through all the posts I could find on age calculation and while it sounds like you all know what you're doing, it's leaving me quite confused.

My goal is to calculate age in years and months (though I suppose I'd settle for years if need be) using a date of birth. The database I'm trying to make is for a small, non-profit school for kids age 3-12, and at the lower side of that range knowing the kid's age down to the month can be pretty helpful.

I realize there are challenges in accomplishing this due to the varying number of days in a month, but I'm hoping someone out there will have a function I can understand. I'm still wet behind my FMPro ears so please use plain English on me!!!

Thanks so much for your brainpower and your willingness to share it....

##### Share on other sites

One more thing:

I have all these fields:

DOB MONTH

DOB DAY

DOB YEAR

DOB

So if calculating the age in years and months is easier with the separate fields, I'm all for that. I did them separate because I wanted to be able to sort by the birthdays to know which birthdays are in a month for each classroom. Is that of any help at all? I think I'd actually prefer keeping the separate fields for the date of birth instead of the consolidated one.

Da

##### Share on other sites

You would calculate the age is years in Filemaker in the same way as you would in your head: first, subtract today's year from the year of birth; then, if this year's birthday has not occured yet, subtract a year:

Year ( today ) - Year ( DOB )

- ( today

Calculating the age in months is more problematic because, as you say, the months vary in length. So the question arises: when does a person born on Jan 31 become one month old? There is no single correct answer to this question. It depends on whatever rules you wish to make up.

For example, this formula computes the age in months on the assumption that a person becomes a month older on the same day-in-month as his birthday or when the month ends - whichever happens first:

12 * ( Year ( today ) - Year ( DOB ) ) + Month ( today ) - Month ( DOB )

- ( Day ( today )

Alternatively, you could just ignore the problem and compute the age in average months:

Div ( today - DOB ; 30.436875 )

Don't use this one to keep track of birthdays, or it can become really embarassing.

##### Share on other sites

• 1 month later...

I was stuck on this too, and this is the calculation I was given. You need two fileds dob and (in my case) YearStartDate as I needed to calculate pupil ages for the start of the year:

If(DayOfYear(dob )

It works! and you can obviously change the YearStartDate whenever you need to calculate a new batch of ages.

Serena

##### Share on other sites

• 3 months later...

Hi Serena, and thank you for your help.

Your calculation makes total sense to me, but I don't understand which parts of it would change for my own fields (which are DOB MO, DOB DAY, DOB YR). Can you help me understand that? And do I need to create a field for the current date and such, or is that just something fmpro knows?

Thank you,

##### Share on other sites

Your calculation makes total sense to me

It does? I find it a little odd that a person born on Sep 1, 2000 will be exactly 6 years and 0 months old on their 7th birthday (but jump straight to 7 years and 0 months on the following day).

##### Share on other sites

• 2 weeks later...

This is what I use, with the help of our Friends from this Forum.

Suppose you have a field â€œDate of Birthâ€, that would be date result;

And a Script to calculate Todayâ€™s Date;

Then a calculation field named "Age", with the following calculation

If(IsEmpty(Date of Birth)=1; GetAsDate("");GetAsText(Year(Today) - Year(Date of Birth) - If(GetAsNumber(Today)= Day(Date of Birth); 0; If(Day(Today- Day(Today))

It works for me (Result Expl: 44 Year(s), 5 Month(s) and 10 Day(s))

##### Share on other sites

• 1 month later...

I've gotten so far into this problem but haven't as yet figured out how to truncate the age to maybe 1 or 2 decimal points.

Using (Get ( CurrentDate ) - DOB:)/365.25 to get close to what I want, but would really like to either drop the decimal positions in the result or just limit it to 1 or 2 decimal points. Anyone got any ideas? Thanks in advance.smiley-smile

##### Share on other sites

• 5 months later...

Age ( Year ) =

Year (Date Today) - Year (DOB) - If (Date Today

Age ( Month ) =

Mod (Month (Date Today) - Month (DOB) + 12 - If (Day (Date Today)

Age ( Day ) =

Day (Date Today) - Day (DOB) + If (Day (Date Today) >= Day (DOB); 0; If (Day (Date Today - Day (Date Today))

Use merge field or use GetAsText function to display age.

Hope this helps.

I've gotten so far into this problem but haven't as yet figured out how to truncate the age to maybe 1 or 2 decimal points.

Using (Get ( CurrentDate ) - DOB:)/365.25 to get close to what I want, but would really like to either drop the decimal positions in the result or just limit it to 1 or 2 decimal points. Anyone got any ideas? Thanks in advance.smiley-smile

• ### Images

• 0
By Soliant Consulting,
• 0
By Soliant Consulting,
• 0
By Soliant Consulting,
• ### Forum Statistics

• Total Topics
33.6k
• Total Posts
141.5k
×
×
• Create New...