 ShowAll Questionssorted byDate Posted lkp

# Leap year giving me an error in Age formula field

I have this formula to caclulate the age of an employee:

IF(ISBLANK(Birthdate__c),
0,
IF(TODAY()-DATE(YEAR(TODAY()),MONTH(Birthdate__c),DAY(Birthdate__c))<0,
YEAR(TODAY())-YEAR(Birthdate__c)-1,
YEAR(TODAY())-YEAR(Birthdate__c)
)
)

There is one person with their birthdate on on a Leap year and is giving me #ERROR in the Age field.  What can I do to add Leap year information?

Thanks. Best Answer chosen by lkp U Jay
IF( ISNULL( BirthDate__c ) ,0.0, (TODAY()- BirthDate__c)/365.25) Suresh Raghuram
do a check on the year from the date of birth by dividing it with 4 and the result equal to 0,then  if you find it as a leap year do not apply the above condition and change your formula such that it will generate the result you are looking for.

If((Date.year() / 4 == 0),(
calcutate the DOB;
,
IF(ISBLANK(Birthdate__c),
0,
IF(TODAY()-DATE(YEAR(TODAY()),MONTH(Birthdate__c),DAY(Birthdate__c))<0,
YEAR(TODAY())-YEAR(Birthdate__c)-1,
YEAR(TODAY())-YEAR(Birthdate__c)
)
)
) Shashikant Sharma
See this : https://developer.salesforce.com/forums/ForumsMain?id=906F00000008ugXIAQ Pratik_M
Hi,

You can refer to the Knowledge Article: https://help.salesforce.com/apex/HTViewSolution?id=000004939&language=en_US

Thanks,
Pratik U Jay
IF( ISNULL( BirthDate__c ) ,0.0, (TODAY()- BirthDate__c)/365.25) lkp