### Calculate Age from Date of Birth in Salesforce

Below formula can be used to calculate age from date of birth in Salesforce -

``````IF(
NOT(ISNULL(BirthDate)), /* Condition to check to make sure BirthDate is not null */
TEXT(FLOOR((TODAY()-BirthDate)/365.2425)) & " year(s) " &
TEXT(FLOOR(MOD((TODAY()-BirthDate),365.2425)/30)) & " month(s)", /* Value IF True */
"" /* Value IF False */
)
``````

1. This comment has been removed by the author.

1. Hi Manohar -

Feeling good that you liked it. Here is the formula which you can use -

Return type: text
TEXT(FLOOR((TODAY() - Date_Of_Birth__c)/365.25)))& " years" & TEXT(MOD((TODAY() - Date_Of_Birth__c),365.25)) & " days"

2. Hi Sudipta,

Thanks for the update.
I tried your formula like below, But date result showing wrong. Please once check and let me know.

Note: Dates showing wrong value and showing xxx.yy days format. I don't need decimal places, please update this.

IF(
NOT(ISNULL(Birth_Date__c)), /* Condition to check to make sure BirthDate is not null */
TEXT(FLOOR((TODAY()-Birth_Date__c)/365.2425)) & " year(s) " &
TEXT(FLOOR(MOD((TODAY()-Birth_Date__c),365.2425)/30)) & " month(s)" &
TEXT(MOD((TODAY() - Birth_Date__c),365.25)) & " days", /* Value IF True */
"" /* Value IF False */
)