You need to sign in to do that
Don't have an account?

period between two date fields in word format
I'm trying to show the Year, Month, Days in word format between two date fields but I can't seem to get it to work right. Below is the formula that I have used. If I have a Lease Start Date as 01.01.2019 and the Lease End Date as 31.12.2019 the formula field shows as 0 Years, 12 Months, 4 Days. Anyone any idea on how I can correct this?
IF(Lease_End_Date__c >= Lease_Start_Date__c,
TEXT(FLOOR((Lease_End_Date__c - Lease_Start_Date__c)/365)) & " Year(s) " &
TEXT(FLOOR(MOD((Lease_End_Date__c - Lease_Start_Date__c),365)/30)) & " Month(s) " &
TEXT(MOD(MOD((Lease_End_Date__c - Lease_Start_Date__c),365),30)) & " Day(s) ", NULL
)
IF(Lease_End_Date__c >= Lease_Start_Date__c,
TEXT(FLOOR((Lease_End_Date__c - Lease_Start_Date__c)/365)) & " Year(s) " &
TEXT(FLOOR(MOD((Lease_End_Date__c - Lease_Start_Date__c),365)/30)) & " Month(s) " &
TEXT(MOD(MOD((Lease_End_Date__c - Lease_Start_Date__c),365),30)) & " Day(s) ", NULL
)
https://success.salesforce.com/answers?id=90630000000CtgqAAC
Try this formula.
IF(ISBLANK(End_Date__c),
TEXT(Year( TODAY() )- Year( Start_Date1__c )) &" "&"Years"&" "&
TEXT(Month( TODAY() )-Month( Start_Date1__c )) &" "&"Months"&" "&
TEXT(Day( TODAY() )-Day( Start_Date1__c ))&" "&"Days",
TEXT(Year( End_Date__c )- Year( Start_Date1__c )) &" "&"Years"&" "&
TEXT(Month( End_Date__c )-Month( Start_Date1__c )) &" "&"Months"&" "&
TEXT(Day( End_Date__c )-Day( Start_Date1__c ))&" "&"Days")
Thanks.
I've found a bug / issue with this formula. Here is what is currently happening with one of the records.
Lease_Start_Date__c = 01/12/2018
Lease_End_Date__c = 30/11/2021
The output when I use this formula shows as 3 years -1 months 29 days when it actually should be 2 years 11 months 29 days
Try this one.
IF(NOT(ISBLANK(Experience1__c)),
TEXT(FLOOR(((End_Date__c -Start_Date1__c)+(End_Date1__c -Start_Date2__c))/365)) &' Years' & ' ' &
TEXT(FLOOR(MOD((End_Date__c -Start_Date1__c)+(End_Date1__c -Start_Date2__c),365)/30)) &' Months' & ' ' &
TEXT(MOD(MOD((End_Date__c -Start_Date1__c)+(End_Date1__c -Start_Date2__c),365),30)) &' Days',
Experience__c
)