+ Start a Discussion
R_AroraR_Arora 

How to reduce the compile time size of the formula field

Hi,

 

I have two fields "Client_Review_Frequency__c" Picklist which has 4 values - Monthly, Quarterly, Bi-Annual ,Annual, and   "Last_Review_date__c"= date field. I want to calculate the Last_Review_date__c on the basis of the Client_Review_Frequency__c Picklist.

 

If use select the Picklist value monthly then a month should be add in the Last_Review_date__c if user select Quarterly then 4 months should be added in the Last_Review_date__c and so on.

 

I have created a formula field with the below formula .when i save this formula an error come which is “Compiled formula is too big to execute (8,131 characters). Maximum size is 5,000 characters”

 

IF(ISPICKVAL(Client_Review_Frequency__c, "Monthly") , IF(MONTH(Last_Review_date__c)>11 , DATE( YEAR(Last_Review_date__c)+1 , MONTH(Last_Review_date__c)-11 ,DAY(Last_Review_date__c) ),

  DATE( YEAR(Last_Review_date__c) , MONTH(Last_Review_date__c)+1 ,DAY(Last_Review_date__c))

  ),

  IF(ISPICKVAL(Client_Review_Frequency__c, "Quarterly") , IF(MONTH(Last_Review_date__c)>8 , DATE( YEAR(Last_Review_date__c)+1 , MONTH(Last_Review_date__c)-8 ,DAY(Last_Review_date__c) ),

  DATE( YEAR(Last_Review_date__c) , MONTH(Last_Review_date__c)+1 ,DAY(Last_Review_date__c))

  ),

   IF(ISPICKVAL(Client_Review_Frequency__c, "Bi-Annual") , IF(MONTH(Last_Review_date__c)>6 , DATE( YEAR(Last_Review_date__c)+1 , MONTH(Last_Review_date__c)-6 ,DAY(Last_Review_date__c) ),

  DATE( YEAR(Last_Review_date__c) , MONTH(Last_Review_date__c)+6 ,DAY(Last_Review_date__c))

  ),

        DATE( YEAR(Last_Review_date__c)+1 , MONTH(Last_Review_date__c) ,DAY(Last_Review_date__c) )

    )

   )

  )

 

 

Please help me to resolve this issue.

RovRov

I was in a somewhat similar situation and this post was great help.

 

http://stackoverflow.com/questions/8170935/date-formula-with-values-of-a-picklist

 

Hope this helps.