How to Create a Salesforce Formula Field to Calculate Age

A company wants to know the exact age of its customers based on the Date of Birth stored in Salesforce.

Instead of calculating it manually every time, they want a formula field that will automatically show the customer’s age in years on the record.

In this article, we will learn how to use the Salesforce formula field to calculate the age. Moreover, we will go through the steps to display the age value in Salesforce.

Salesforce Formula Field to Calculate Age

For event management, financial planning, healthcare management, contact management, and other similar services, we require age verification. To keep track of age, we need to define an advanced formula for calculating age.

And to create the age calculation formula, Salesforce provides us with various built-in functions that help us calculate it. Let’s have a look at an advanced formula that calculates age in Salesforce.

Formula #1

FLOOR((TODAY() - Birthdate ) / 365.25)

In this formula, we calculate the age based on the date of birth, but make sure the year of the dob is a leap year. Here, we use the TODAY() function to get the current date, and then we subtract it from the date of birth.

Next, we divide the result by 365.25 as we assume that the year of the date of birth field is a leap year, and then, to round the result to the nearest integer, we use the FLOOR() function.


Formula #2

ROUND((TODAY() - Birthdate ) /