 ShowAll Questionssorted byDate Posted Ramakrishnan Ayyanar

# Next birthday formula field

Hi Friends,

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

code:

if(
MONTH(ramki__DOB__c) = 2 &&
DAY(ramki__DOB__c) = 29 ,
DATE(
IF(Year(Today())<=Year(ramki__DOB__c),Year(ramki__DOB__c),
IF(
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))
),
MONTH(ramki__DOB__c),DAY(ramki__DOB__c)),
if(
Year( ramki__DOB__c ) <= Year(Today()) && MONTH(Today())<= MONTH(ramki__DOB__c)&& DAY(Today()) <= DAY(ramki__DOB__c) ,
DATE(Year(Today()),MONTH(ramki__DOB__c),DAY(ramki__DOB__c)) ,
DATE(IF(Year(Today())<Year(ramki__DOB__c), Year(ramki__DOB__c),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)

----

softramki@gmail.com

+919944112175 @anilbathula@

Hi Ramakrishnan,

Try this formula:-
I used contact birthdate field to calculate next birthday

IF(MONTH(Birthdate)>MONTH(TODAY()),DATE(YEAR(TODAY()),MONTH(Birthdate),DAY(Birthdate)),
IF(MONTH(Birthdate)<MONTH(TODAY()),DATE(YEAR(TODAY())+1,MONTH(Birthdate),DAY(Birthdate)),
IF(DAY(Birthdate) >= (DAY(TODAY())),DATE(YEAR(TODAY()),MONTH(Birthdate),DAY(Birthdate)),
DATE(YEAR(TODAY())+1,MONTH(Birthdate),DAY(Birthdate))))) Ramakrishnan Ayyanar

Hi Anil,

Thanks for response.I already written this code.In this code have some
problem here .

Problems:

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.........

Easily Calculate Age:

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

Age=YEAR( ramki__BirthDay__c) - YEAR(ramki__DOB__c)

----

softramki@gmail.com

+919944112175 @anilbathula@
Good work A.Ramakrishnan Rajeshkumar.T

Hi Friends,

Here is a sample code

if(
MONTH( visualremote__D_O_B__c ) = 2 &&
DAY(visualremote__D_O_B__c ) = 29,
DATE(Year(Today())+ 4-MOD(Year(Today()),4) , MONTH(visualremote__D_O_B__c ) , DAY(visualremote__D_O_B__c )) ,
IF( MONTH( visualremote__D_O_B__c ) >= MONTH( TODAY()) && DAY(visualremote__D_O_B__c )>= DAY( TODAY() )
, DATE( YEAR(TODAY()) , MONTH(visualremote__D_O_B__c ) , DAY(visualremote__D_O_B__c ))
, DATE( YEAR(TODAY())+1 , MONTH(visualremote__D_O_B__c ) , DAY(visualremote__D_O_B__c ) ) ))