Blog

Calculate age from date of birth

1

Some time ago I was asked by our human resources department to provide the age of each staff member based on their date of birth. We had their dates of birth stored in salesforce already, so that made things a little more straightfoward. The solution was to create a date formula field as described below…

I noticed that this recently came up on the salesforce community forums – and Jaskester came up with a great solution, which I believe takes into account leap years.

IF(ISNULL(Birthdate),0,FLOOR((TODAY()-Birthdate)/365.2425))

I hope that someone will find this useful, all credit goes to Jakester (original post here)

Update to include formula which takes leap years into account:

IF(MONTH(TODAY())>MONTH(Birthdate),
YEAR(TODAY())-YEAR(Birthdate),
IF(AND(MONTH(TODAY())=MONTH(Birthdate),
DAY(TODAY())>=DAY(Birthdate)),
YEAR(TODAY())-YEAR(Birthdate),
(YEAR(TODAY())-YEAR(Birthdate))-1))
  • Jake

    Thanks so much for sharing this handy little tip. I appreciate you giving me the credit, but I have to confess all I did was search Salesforce help for "age" and the third result was that exact formula which I pasted into the forums. My mistake for giving Salesforce the credit in my original post.