HubSpot Ideas

CJenkins2

Age Calculation

It would be geat to have a native feature that will calculate the age for contacts rather than the workaround via workflow by creating a custom property  "today's date". 

9 Replies
APickering
Member

PLEASE make this a native function in HubSpot or give clear examples of workflows to make it happen. Age is extremely necessary for our business. 

GrantCarlile
Top Contributor | Diamond Partner

It would be great to have a DOB field native. Then from there let the display types be the various things people want. 

Arden
Member

it's possible to use a workflow and a calculated property to approximate their age, but even that doesn't quite work, as calculated properties round to the nearest number, so if a contact is e.g. 23 years and 8 months old, it will round up to 24 years old.

Arden
Member

After some work, here's the best solution/workaround I've been able to come up with.

To get a calculated age:

  • Create (if you don't have one) a date property for Date of Birth 
  • Create a date property to store the last date age was calculated. e.g. "internal - last date age calculated"
  • Create a calculation property (e.g. internal - calculated age (rounded)) that is the time between "Date of Birth" and "internal - last date age calculated"
  • Create an active list (e.g. "Workflow - requires age update") whose rule is "if last calculated age date hasn't been updated in 30 days or is empty" AND "Date of Birth" is known. (feel free to choose a different frequency if desired. I just didn't want to bog down the system unneccessarily and once a month seemed fine)
  • Create a workflow that enrolls anyone in the previously made list. be sure to enable re-enrollment. this workflow will only have one step: update the "internal - last date age calculated" property to "today's date".

This setup mostly works, with one exception -- calculated properties will round times to the nearest year when displaying the value in a contact view. so if someone is e.g. 31 years old and 6+ months, then they will be rounded up to 32 years old.  A workaround to get a more accurate age:

  • Create a calculation property (e.g. Calculated Age) and give it a custom formula of: "internal - calculated age (rounded)" / 31536000000

why 31,536,000,000? because the time between property ("internal - calculated age (rounded)") is stored in 1000ths of a second. so 1000 * 60 seconds * 60 minutes * 24 hours * 365 days = 31,536,000,000. 

Afterward, your new "Calculated Age" property will display age with several decimal points. e.g. 22.7893.

Hope this helps others. I'd much prefer a built in field, but this will do for now. haha.

APickering
Member

@Arden thanks Arden! Will try.

VEspo
Contributor

This is really imprtant for us too!

YInui
Member

@Arden Thank you for your very helpful answer!

>1000 * 60 seconds * 60 minutes * 24 hours * 365 days = 31,536,000,000. 
This is not considered about a leap years.
I believe the formula below is better
1000 * 60 seconds * 60 minutes * 24 hours * 365.25 days = 31,557,600,000

Courtney_Clark
Participant

I'm really surprised this isn't a feature yet. This is definitely needed. 

scm22ri
Participant

@Arden would it be unreasonable for me to request that you make a video of your above answer? Thanks.