You need to sign in to do that

Don't have an account?

# 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__c** = 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

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

Karthikeyan Jayabal

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

## All Answers

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:

But behind the scenes, it is:

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__cinto 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

user10286thanks 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.

ericmonteI'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 ericmonte is suggesting - WF and WF-Actions are the only way around it. As your formula is substancially big.

The other way is throught Apex Coding. I had a similar issue and it took a while to get the logic working around to fit without Apex code. But, there is a limit to which you can push without Apex..

PS: Your work aroud will get bigger than you expect.

MellowRen

- 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.

- 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.

- 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.

Timon

I had some thoughts, none of them ideal.

Best I can think of.

Regards

MellowRen

Karthikeyan Jayabal

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

user10286thanks for reply guys

Jaime Ortega 6Thanks MellowRen. I'm having the same problem with six formula fields I'm trying to add together in a single formula field, but get the same error and haven't been able to firgure a way around the 5000 character limitations, but the number field with a workflow to keep it updated seems like it may work. Then I'll create a formula field that adds the number fields together. Bit of a hassle, but sounds like it will do the trick. Thanks.