Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
ShowAll Questionssorted byDate Posted
nikki goud

# Formula

HI
i crete one formula field for find the age of student in that i wrote dis (YEAR(TODAY())-YEAR(DOB__c) Formula
now i get age in years
next one more formula fiedls for months in that i wrote dis MONTH(TODAY())-MONTH(DOB__c) formula and days for DAY(TODAY())-DAY(DOB__c).
I get perfect answers but my requirement is in need years months days in one formula field ...
If you want it in one field the field will need to be a text formula field. Then change the results of each of those formulas to TEXT eg TEXT((YEAR(TODAY())-YEAR(DOB__c) + 'yrs ' + TEXT(MONTH(TODAY())-MONTH(DOB__c)) + 'mths ' + TEXT(DAY(TODAY())-DAY(DOB__c) + 'days'))
Agi
Hi, you may try this one:

if(And(Month(Today())>= month(DOB__c), Day(Today()) >=  Day(DOB__c)),

TEXT(Year(Today())- Year(DOB__c)) &" "&"years"&" "&
TEXT(Month(Today())-Month(DOB__c)) &" "&"months"&" "&
TEXT(Day(Today())-Day(DOB__c)),

if(And(month(Today())< month(DOB__c), Day(Today())>= Day(DOB__c)),

TEXT(Year(Today())-Year(DOB__c)-1)&" "&"years"&" "&
TEXT(12 - Month(DOB__c)+month(Today()))&" "&"months"&" "&
TEXT(Day(Today())-Day(DOB__c)),

if(And( month(Today())< month(DOB__c), Day(Today())< Day(DOB__c)),

(TEXT( (Year(Today())-Year(DOB__c)-1))&" "&"years"&" "&
TEXT((12 - Month(DOB__c)+month(Today())-1))&" "&"months")&" "&
if( month(DOB__c)= 4, TEXT( (30 - Day(DOB__c))+ Day(Today())),
if( month(DOB__c)= 6, TEXT( (30 - Day(DOB__c))+ Day(Today())),
if( month(DOB__c)= 9, TEXT( (30 - Day(DOB__c))+ Day(Today())),
if( month(DOB__c)= 11,TEXT( (30 - Day(DOB__c))+ Day(Today())),
if( month(DOB__c)= 2, TEXT( (28 - Day(DOB__c))+ Day(Today())),
TEXT( (31 - Day(DOB__c))+ Day(Today()))))))),

if(And( month(Today())= month(DOB__c), Day(Today())< Day(DOB__c)),

(TEXT(Year(Today())- Year(DOB__c)-1))&" "&"years"&" "&
"11"&" "&"months"&" "&
if( month(DOB__c)= 4, TEXT( (30 - Day(DOB__c))+ Day(Today())),
if( month(DOB__c)= 6, TEXT( (30 - Day(DOB__c))+ Day(Today())),
if( month(DOB__c)= 9, TEXT( (30 - Day(DOB__c))+ Day(Today())),
if( month(DOB__c)= 11,TEXT( (30 - Day(DOB__c))+ Day(Today())),
if( month(DOB__c)= 2, TEXT( (28 - Day(DOB__c))+ Day(Today())),
TEXT( (31 - Day(DOB__c))+ Day(Today()))))))),

(TEXT(Year(Today())- Year(DOB__c)))&" "&"years"&" "&
TEXT(Month(Today())-Month(DOB__c)-1)&" "&"months"&" "&
if( month(DOB__c)= 4, TEXT( (30 - Day(DOB__c))+ Day(Today())),
if( month(DOB__c)= 6, TEXT( (30 - Day(DOB__c))+ Day(Today())),
if( month(DOB__c)= 9, TEXT( (30 - Day(DOB__c))+ Day(Today())),
if( month(DOB__c)= 11,TEXT( (30 - Day(DOB__c))+ Day(Today())),
if( month(DOB__c)= 2, TEXT( (28 - Day(DOB__c))+ Day(Today())),
TEXT( (31 - Day(DOB__c))+ Day(Today()))))))))

)))&" "&"days"