You need to sign in to do that

Don't have an account?

# Compilation of formula is showing too big to execute

Hi Friends,

I have a requirement for doing the calculation in formula field,

when I save the calculation of a formula field,

it is showing the,

Compiled formula is too big to execute (6,395 characters). Maximum size is 5,000 characters.

formula is looking like this,

[CV* ( 1+IPV/100)**( NM/12)] +[ Sum from Y= 1to Y=NY of { AC* [( 1+ INCC/100)**( NY-Y+1)] *[ (1+IPV/100)**Y]},

as our requirement i did this formula is like this,

Financial_Detail__r.Plan_current_value__c * ( ( Financial_Detail__r.Rate_of_Increase_in_Plan_Value__c ) ^ ( CEILING( Complete_month_bwn_maturity_year_today__c / 12) ) )

+

( Complete_years_bwn_Maturity_yr_today__c )

*

(( Plan_Annual_Contribution__c )

*

(( ((1+ Rate_of_incr_in_contributions_this_plan__c ) ^CEILING ( Complete_years_bwn_Maturity_yr_today__c-( YEAR( TODAY() ) - YEAR( Financial_Detail__r.Plan_beginning_year__c ) )+1 ))

*

((1+ Financial_Detail__r.Rate_of_Increase_in_Plan_Value__c )^CEILING(YEAR( TODAY() ) - YEAR( Financial_Detail__r.Plan_beginning_year__c ))))))

Can any one please tell me,how to resolve this problem?

Thanks in Advance,

Thanks and Regards,

Srinivas Chittela

zen_nj

I would suggest create two formula fields instead of one.

So in the first formula field, it would just contain 1/2 of your formula. So if your original formula is something like:

a+x+c ..... + d*f+e +g*h*i + ... l*k+m

then you would create formula field 1 = a+x+c ....+d*f+e

and then formula 2 would be= formula field 1 + g*h*i + ...l*k+m

You can always hide formula field 1 (since it's really an intermediate/scratch field) from page layout to avoid confusion

csrsak

Hi Zen,

Thanks for Quick Reply.

I spilt that formula in to two formulas fields and when I call those two formula fields in actual formula field,

And when I saved that formula it is still showing 'Compiled formula is showing too big to execute'.

Please help me how to resolve this issue.

Thanks in advance,

Thanks & Regards,

Srinivas Chittela

zen_nj

Ok, it looks like you are hitting one of the limitation for formula field.

In general, there are two limits:

1. each individual formula has a charater limit of 3900 - this can be remedied by splitting the formula field into

2 fields where each individual field is under 3900. I was thinking initially that yours would be this limit which

is easier to fix and you do that just by splitting the formula field into 2 smaller ones.

2. when the whole combination of formula field (i.e. one formula field that refers to other formula field)

exceeds 5000 characters. It looks like this is actually what's happening, that your total formula exceeds

5000 characters - so even if individually we don't hit the 1st limit, the combination does exceed it.

For this, there's really no easy fix. You could try and re-examine the formula and see if there's any way you

can reduce or elimiate stuff from your formula code - maybe if you had something like: a*x + (a+b)+ a*y

you can convert to: a(x+y+1)+b

otherwise instead of splitting your formula field into two formula field (say F1__c and F2__c), you may

need to create two formula field (F1__c and F2__c) and one regular field (i.e. a number field say N1__c)

and that regular field you would actually update the value via workflow (use field update) and use formula

to update and in the formula value just use F1__c.

Then in F2__c you would now reference the rest of your formula code + N1__c instead of: rest of formula

code + F1__c

csrsak

Hi Zen,

Thanks for Reply,

As per your suggestions, I created the field update using the workflow rule for regular field to update the formula field value, it is really help full to reduce the size limit of the formula, but while creating the field update I unable to get the formula field value in regular field, I check that formula separately, it is working fine. Might be I did mistake in field workflow rule & field update.

I did the workflow rule and field update like this,

In workflow rule,

I created the rule name, Evaluation Criteria is, when record is created. Or when a record is edited and didn't previously meet the rule criteria.

And I gave the rule criteria as,

Criteria are met when the formula field not equals to zero,

Then I update the regular field.

Please correct me the right way.

Thanks in Advance,

Regards,

Srinivas Chittela

zen_nj

I think what you need to do is change the rule criteria so that it will fire off whenever the entry is created or whenever it is edited (and not just when it is edited and did not meet previous criteria).

That is, I am assuming your formula field will also be non-zero if there is some value in the other fields that is used to derive the formula value. So this workflow rule would have fired only when a record is first created, but not for subsequent updates since when you update the record, by then I would imagine the formula is not zero and so the workflow rule would not have been triggered.

But if even during record creation, you are still not getting the regular field to be updated with the formula field, then there is something wrong. Did you remember to activate the workflow rule after you have created it?

Suraj Tripathi 47Hi,

Greetings!

There are some limitations of the formula field. So you can not go beyond limitations.

So, this formula takes too much time to execute.

Please reach out salesforce support team, they will help you regarding this.

If you find your Solution then mark this as the best answer.Thank you!

Regards,

Suraj Tripathi