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 Jotform Support
    Replied on June 11, 2015 at 1: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.

    Age Calculation Image 1 Screenshot 20

     

    Do let us know if you need further assistance.

     

    Regards.

  • GICS
    Replied on June 11, 2015 at 1:32 AM

    Brilliant! Many thanks.

    Peter

  • Chriistian Jotform Support
    Replied on June 11, 2015 at 3:16 AM

    Hi GICS, 

    You are welcome. Glad to hear that your concern was solved.

     

    If you need further assistance, please feel free to contact us again.

     

    Regards.

  • GICS
    Replied on June 11, 2015 at 8: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
    Replied on June 11, 2015 at 10:20 AM

    Peter, please try calculating the age as:

    age / 365.25

    Age Calculation Image 1 Screenshot 20

    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
    Replied on June 11, 2015 at 8: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..

    The full answer is..

    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 Jotform Support
    Replied on June 11, 2015 at 11:32 PM

    Hi GICS, 

    Glad to hear that you have solved your problem.

     

    Do let us know if you need further assistance.

     

    Regards.