Skip to main content
Hi All,

 

I have two fields on  the object i.e start_date__c(date) and total_months__c(number).

 

I need to create one formula field which can add total_months__c into the start_date__c however should be added only into the months not into the days.

 

For ex : if my start_date__c = 01/01/2012 and total_months__c = 24, then the formula field = 01/01/2014.

 

Please help experts and thanks in advance.
3 Antworten
  1. 20. Aug. 2015, 08:36
    Hi John,

     

    Please try the below

    DATE(

    YEAR(Start_date__c)+ FLOOR((Month(Start_date__c) + total_months__c)/12) + IF(AND(MONTH(Start_date__c)=12,total_months__c>=12),-1,0),

    IF(

    MOD( MONTH(Start_date__c) + total_months__c , 12 ) = 0, 12 ,

    MOD( MONTH(Start_date__c) + total_months__c , 12 )

    ),

    MIN(

    DAY(Start_date__c),

    CASE(

    MAX( MOD( MONTH(Start_date__c) + total_months__c , 12 ) , 1),

    9,30,

    4,30,

    6,30,

    11,30,

    2,28,

    31

    )

    )

    )

     

     
0/9000