function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion

Next birthday formula field

I'm trying to implement an "upcoming birthdays" report as described here:

except that

1. the images in that blog post are broken, and
2. i don't want to install the entire appexchange package (9 components) when all I really need to see is the formula field definition for "Next Birthday."

Anyone have this package installed already and willing to share the formula? Thanks!

I can see the images so I just copied the formals.  I have not downloaded the application though because it is too big. But if you want the application I suggest getting a Developers login (they are free) and try downloading it into that.

This formula takes the birthdate, and, if the date this year has already gone by, it gives it next year's year number, or it sets the next birthday as the day and month of the birthdate, with this year...


Next is a simple one that looks at age. This just looks at the years between the birthdate and the next birthday:

YEAR( tobinators__Next_Birthday__c) - YEAR(Birthdate)

I just installed the package it seemed to be working great, and then I clicked to view the report as I added some fields to it and wanted to see the updates and I recieved the following error:

Computed an invalid date, such as February 29th on a non-leap year. Please contact your administrator; formula fields can cause such errors.

What do I do to fix the error?  I am very new to SFDC especially the formula side of things, and am clueless as what to do to make this work...



What this error means is your custom formula field is creating an invalid date.

Suppose someone puts in a date of 2/29/2008. The formula you have will make the next birthday 2/29/2009 which is invalid.

You should check out this thread I started about calculating the birthday for the next year:

In order to avoid the 'bad birthday', I have a validation rule which says if the day is 29 and the month is 2, force the user to put in 2/28 or 3/1.

Good Luck!


Thank you for your help!

I reviewed the your suggested thread great information - hopefully I will understand workflows better soon and i can implement that in our system.

Can you potentially give me an example of what the validation rule would look like?  I dont even know where to start on that.  I am a very new user.

I assume the validation rule would be for "Birthdate" i just dont know what it should look like.




Here is the validation rule I used:

AND (DAY(Birthdate)=29,MONTH(Birthdate)=2)

This prevents users from putting in a leap year birthday.

Good Luck!



Ramakrishnan AyyanarRamakrishnan Ayyanar

1)If DOB is Feb 29 Leap year.How to find next birthday for that particular date?

No Need Validation rule for this code.

End-of-century years 1700, 1800,1900,2100 these years are not leap year in these problems are resolved.........

To find the next Birthday formula

How to create......

step-1: create the custom field for Date of Birth----It's type-Date

step-2: create the formula field for Birthday ---It's type-Date


iIF ( MONTH (ramki__DOB__c)=2 && DAY (ramki__DOB__c)=29,
OR(MOD(Year(Today())+ 4-MOD(Year(Today()),4),400)=0,
AND(MOD(Year(Today())+ 4-MOD(Year(Today()),4),4)=0,
MOD(Year(Today())+ 4-MOD(Year(Today()),4),100)<>0)),
Year(Today())+ 4-MOD(Year(Today()),4),
Year(Today())+ 8-MOD(Year(Today()),4))
IF (DATE (YEAR(TODAY()),MONTH(ramki__DOB__c),DAY(ramki__DOB__c)) > TODAY(),
DATE (YEAR(TODAY()),MONTH(ramki__DOB__c),DAY(ramki__DOB__c)),
DATE (YEAR(TODAY())+1,MONTH(ramki__DOB__c),DAY(ramki__DOB__c))

it's correctly worked for leap year dates.......
this is code for find the next Birthday friends......

Easily Calculate Age:

create formula field -------(Number)

Age=YEAR( ramki__BirthDay__c) - YEAR(ramki__DOB__c)