# Age Calculation

• GICS
Asked on June 11, 2015 at 12:50 AM
Further to this, I would like to have a calculation that populates the age field in years where the age is the age as at the start date of the competition. Is this possible?
• Chriistian
Answered on June 11, 2015 at 01:23 AM

Hi GICS,

Thanks for contacting us.

Yes this is possible, you can check this form that I created http://form.jotformpro.com/form/51610432657956You can clone this form so you can check out the setup. This is done using Date/Time Tool under Quick Tools and a Form Calculation Widget. You can check the calculation formula when you open the calculation wizard by clicking the wand icon.

Do let us know if you need further assistance.

Regards.

• GICS
Answered on June 11, 2015 at 01:32 AM

Brilliant! Many thanks.

Peter

• Chriistian
Answered on June 11, 2015 at 03:16 AM

Hi GICS,

Regards.

• GICS
Answered on June 11, 2015 at 08:37 AM

Hi Chriistian,

On a closer look, the age does not calculate exactly especially when a birthday might be just either side of the competition start date.

I think it has something to do with the number of days in the year and that we want the age expressed in years, so we probably need a way to remove the part of the answer to the right of the decimal point.

Interesting little dilemma.

Peter

• Boris
Answered on June 11, 2015 at 10:20 AM

Peter, please try calculating the age as:

age / 365.25

I have made a demo form with a changed calculation, it should be rather accurate:

http://form.jotformpro.com/form/51613647325959

Please let us know if this works better for your needs, or please let us know example dates it calculates wrong, so that we can take a look if we can somehow tweak it to better suite your specific case. Thank you.

• GICS
Answered on June 11, 2015 at 08:37 PM

No, that didn't work on it's own.

I was correct in my assumption that although I present the answer to 0(zero) decimal places, the decimal part of the answer is still there..

Calculate days by subtracting the birth date from the start of comps date

Then Age = FLOOR(days\365.25)  - the 0.25 accounts for leap years

FLOOR strips off the decimal part of the answer.

This seems to work now.

Whew.

Peter

• Chriistian
Answered on June 11, 2015 at 11:32 PM

Hi GICS,