You need to sign in to do that
Don't have an account?
Formula field for calculate age by using DOB
HI All,
How to create a fomula field for my age field ? It will be calculated by using the Date_of_Birth__c field. I have a fomula.
IF(MONTH(TODAY())>MONTH(DOB_API),YEAR(TODAY())-YEAR(DOB_API),IF(AND(MONTH(TODAY())=MONTH(DOB_API),DAY(TODAY())>=DAY(DOB_API)),YEAR(TODAY())-YEAR(DOB_API),(YEAR(TODAY())-YEAR(DOB_API))-1))
That's from Ankit's blog. But I don't know how to use it and where to use it.
Thanks in Advance
Yes thats a correct formula , you can use above
If you want to go for smaller formula
Use this one : From http://forceschool.blogspot.com/2011/06/age-calculation-formula.html
Now to your question how to use it.
1) Create a formula field return type Integer
2) Use any of the formula , replace your date field API Name with DOB__c
Then you will see this Calculated Age in your formula field.
All Answers
Yes thats a correct formula , you can use above
If you want to go for smaller formula
Use this one : From http://forceschool.blogspot.com/2011/06/age-calculation-formula.html
Now to your question how to use it.
1) Create a formula field return type Integer
2) Use any of the formula , replace your date field API Name with DOB__c
Then you will see this Calculated Age in your formula field.
@Chamil Good to know someone is reading my blog :)
@Shashikant Thanks for sharing this sort trick and it worked for me too, but there was a small change :
I have converted the return type from integer to text and formula to :
As I was unable to compile the formula provided.
Thanks
Ankit Arora
Blog | Facebook | Blog Page
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
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( today()) <= Year( ramki__DOB__c) ,
DATE(Year(ramki__DOB__c),MONTH(ramki__DOB__c),DAY(ramki__DOB__c)) ,
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)
----
softramki@gmail.com
+919944112175
IF( NOT( ISBLANK( Birthdate ) ) ,
2 IF( DATE( 2000 , MONTH( Birthdate ) , DAY( Birthdate ) ) <= DATE( 2000 , MONTH( TODAY() ) , DAY( TODAY() ) ),
3 YEAR (Today()) - YEAR ( Birthdate ),
4 YEAR (Today()) - YEAR ( Birthdate ) -1 ),
5 null)
Thanks.
1) Create a formula field return type "Number"
2) Use Formula i below mentioned , replace your date field API Name with DOB__c
( TODAY() - DOB__c )/365
..
you sharing Myeclass Login (https://gab.com/myeclass/posts/110672353487088811" target="_blank)