 ShowAll Questionssorted byDate Posted user10286

# Error: Compiled formula is too big to execute

Hi All,

when I save the below formula, it shows this error:

Error: Compiled formula is too big to execute (19,959 characters). Maximum size is 5,000 character

if the sum of Value_1__c to Value_13__c <= 10, then  display level 1

if the sum of Value_1__c to Value_13__c >10 and Value_1__c to Value_13__c <= 18, then  display level 2

if the sum of Value_1__c to Value_13__c >18 then level 3

formula value:

if((Value_1__c + Value_2__c +Value_3__c + Value_4__c + Value_5__c + Value_6__c + Value_7__c + Value_8__c + Value_9__c+ Value_10__c + Value_11__c + Value_12__c + Value_13__c) <= 10

&&
(Value_1__c + Value_2__c +Value_3__c + Value_4__c + Value_5__c + Value_6__c + Value_7__c + Value_8__c + Value_9__c+ Value_10__c + Value_11__c + Value_12__c + Value_13__c ) <> 0 , "Level 1",
if( AND((Value_1__c + Value_2__c +Value_3__c + Value_4__c + Value_5__c + Value_6__c + Value_7__c + Value_8__c + Value_9__c + Value_10__c + Value_11__c + Value_12__c + Value_13__c) > 10
&&
(Value_1__c + Value_2__c +Value_3__c + Value_4__c + Value_5__c + Value_6__c + Value_7__c + Value_8__c + Value_9__c+ Value_10__c + Value_11__c + Value_12__c + Value_13__c) <= 18), "Level 2",
if((Value_1__c + Value_2__c +Value_3__c + Value_4__c + Value_5__c + Value_6__c + Value_7__c + Value_8__c + Value_9__c+ Value_10__c + Value_11__c + Value_12__c + Value_13__c) > 18,"Level 3",
"Level Not Calculated Yet" )))

All field Value_1__c to Value_13__c also formula field which get s the value from the picklist selected.

we tried this also:

total_risk_cal__cValue_1__c + Value_2__c +Value_3__c + Value_4__c + Value_5__c + Value_6__c + Value_7__c + Value_8__c + Value_9__c+ Value_10__c + Value_11__c + Value_12__c + Value_13__c

if((total_risk_cal__c) <= 10
&&
(total_risk_cal__c ) <> 0 , "Level 1",
if( AND((total_risk_cal__c) > 10
&&
(total_risk_cal__c) <= 18), "Level 2",
if((total_risk_cal__c) > 18,"Level 3",
"Level Not Calculated Yet" )))

but getting same error.

Kindly tell how resolve this Best Answer chosen by Admin (Salesforce Developers)  Karthikeyan Jayabal

Check this message where the same problem was discussed. Hope this solves the issue temporarily. MellowRen

First a quick explanation on formulas. In Salesforce, when a formula references another formula, the latter gets embedded into the former behind the scenes. Hence, we see:

```Value_1__c = Quantity * UnitPrice
Value_2__c = Discount * Quantity * UnitPrice
Value_3__c = IF(Value_1__c > 100, Value_1__c, Value_2__c)```

But behind the scenes, it is:

```Value_1__c = Quantity * UnitPrice
Value_2__c = Discount * Quantity * UnitPrice
Value_3__c = IF(Quantity * UnitPrice > 100, Quantity * UnitPrice, Discount * Quantity * UnitPrice)```

This is why it becomes easier than expected to hit the 5000 character limit. It is also why your second attempt didn't help.

How to solve? To the best of my knowledge you can't get around the 5000 character limit. And at 20K of characters, it is a pretty safe bet you aren't going to figure out a way to write a 4x shorter formula.

Best I can think of doing would be to turn total_risk_cal__c into a Number field (a pure Number field, not a formula field which produces a number), then use either a workflow or a trigger to keep it up to date. You then should be able to use your second formula without any problems.

Good luck,

MellowRen user10286

thanks for reply MellowRen im using PE MellowRen

PE? **bleep**, that is not good. I do not have a solution for you there. Sorry mate, hopefully someone else might have an idea. Fingers crossed.

----- Edit -----

**bleep** ????  Ha ha ha ha, that's harsh. I did not use a word that I would consider vulgar at all. This auto-edit makes it look like I used the F - word or something. ericmonte

I've come across this issue before and I actually had a work around on this, where I used a Workflow and Field Update. You might want to see if this is an option for you. T-Han

Big formulas are always a challenge. As MellowRen

Timon

I had some thoughts, none of them ideal.

1. First of all, if this risk measurement is really important it could be the basis of a proposal to whoever to get off PE and on to at least EE. Worth a try.

2. You can use the Excel Connector with PE. You could export all the Value_x__c fields on a daily/weekly basis, use an Excel formula to calculate the risk level field and re-import that into Salesforce. Obviously not live data but it would be accurate.

3. Lastly, PE does allow you to add buttons that execute Javascript. You could in theory create one that calculates and populates the risk level value. The big problem here would be training your users to press it. I thought about creating, if possible, a replacement save button (ie it updates the field and then saves the record) but I don't think that you can remove the default save button which brings back the same problem—training the users.

Best I can think of.

Regards

MellowRen Karthikeyan Jayabal

Check this message where the same problem was discussed. Hope this solves the issue temporarily.

This was selected as the best answer user10286 Jaime Ortega 6