Skip to main content
We sell licences by months or years, e.g. buy a licence for 3 years and 6 months duration. I have a start and end date but count work out how to convert the difference to show rather than a number of days difference by by how many years and months.

 

An example if start date was 27/12/2013 and end date was 27/12/2016 - then my custom formula should show 3 years.

 

Another example is if the start date was 27/12/2013 and the end date 27/01/2017 then the result would show 3 years 1 month.
2 个回答
  1. 2013年12月27日 15:41
    Try out this one (a good approximation of what you want):

     

    CASE(FLOOR((End_Date__c - Start_Date__c) / 365),

     

      0, '',

     

      1, '1 year ',

     

      TEXT(FLOOR((End_Date__c - Start_Date__c) / 365)) & ' years '

     

    ) &

     

    TEXT(FLOOR((End_Date__c - Start_Date__c - 365 * FLOOR((End_Date__c - Start_Date__c) / 365)) / 30)) & ' months'