Since you're starting with a text value for date of birth, the formula could take on many shapes, depending on how your date of birth is formatted. Assuming it is formatted as YYYY-MM-DD, then the formula field would be simple:
FLOOR((TODAY() - DATEVALUE(date_of_birth__c))/365.2425)
If your text field is formatted in another date fashion (DD/MM/YYYY or MM/DD/YYYY) the formula gets a little more complicated.
For MM/DD/YYYY:
FLOOR((TODAY() - DATEVALUE(RIGHT(Birthdate1__c,4)+"-"+LEFT(Birthdate1__c,2)+"-"+RIGHT(LEFT(Birthdate1__c,5),2)))/365.2425)
For DD/MM/YYYY:
FLOOR((TODAY() - DATEVALUE(RIGHT(Birthdate1__c,4)+"-"+RIGHT(LEFT(Birthdate1__c,5),2)+"-"+LEFT(Birthdate1__c,2)))/365.2425)
If you're using 2-digit years, then all of the formulas above would need to be adjusted to handle that.
3 respuestas