How To Calculate Current Age Formula

Hi again!

How can I calculate someone’s current age? I want the age of the client to be shown once the date of birth is entered, but in another input field. Like in the example below. Can anyone help?

Hi @simone,

You can add a text element to the page and use something like this:

THANK YOU, you’re a genius ! When the DOB field isn’t populated it shows “2019” for the age text. I’m going to try and hide it until the DOB is populated. Wish me luck! LOL

@simone No problem! You could do something simple to hide the text until the DOB is filled out…

Not sure if that’s what you’re looking for though.

Sorry, it doesn’t populate the age when adding this condition.

Is the DOB a date/time field or input?

If you’d like, I’d be happy to take a look. Can you pm or share the editor?

It’s an input field.

This is how I created the formula based on it being an input field for the DOB

I’m able to produce it with it being an input. Have you made sure to set the Content Format of the input to Date? Your instance looks setup correctly:

Current date/time:extract year - InputDOB’s value:extract year

Condition: When inputDOB’s value is empty
This element is visible = unchecked

Yes, the content is Date

And this is the current condition for the text

I’ll just PM

Your ‘Text Current date/time:ex’ should be set to the input, not the date/time picker.

When InputDOB’s value is empty = This element is visible should be unchecked

-Sure, pm is fine

Hi. I followed your recommendation in calculating age. However, when patient’s birth month is higher than the current month, the age becomes wrong

Example:
DOB: Sep 2, 2018
CurrentD: Aug 21, 2019
Age: 1
But is must be 0.

Solution:
I put a condition wherein if the “DOB:extract month > Current Date:extract month”, then change text to “CurrentD:extract year - DOB:extract year - 1”

The example becomes correct

However another scenario is if DOB and current date has the same month but DOB has greater day. Even with the condition above, calculation is not be affected.

Example:
DOB: Aug 28, 2018
CurrentD: Aug 21, 2019
Age: 1
But it must be 0

Any workaround here?

Hi @shu.teopengco, can you show a screenshot of the conditional that isn’t working the way you want it to?

Sorry for the confusion. I’m only using mobile now. Will take a screenshot when I get my laptop. My conditionals are working. However can’t think of a condition for my lst example.

DOB: Aug 28, 2018
CurrentDate: Aug 21,2019
Age?

How can I get a correct age with this? “CurrentD:extract year - DOB:extract year” won’t work. It will be “1” but it should only be “0” because it’s still 7days before the birthday

This topic was automatically closed after 70 days. New replies are no longer allowed.