ShowAll Questionssorted byDate Posted
Andrew Chappell

# Error: Compiled formula is too big to execute (5,501 characters)

We are trying to create a field formula to calculate commissions based on down payment percentage. The IF formula is slightly too big. Any suggestions to make this formula fit?

IF(Down_Payment_Percent__c >= 0.1 && Down_Payment_Percent__c <= 0.2499, Amount *0.08,

IF(Down_Payment_Percent__c >= 0.25 && Down_Payment_Percent__c <= 0.4999, Amount *0.09,

IF(Down_Payment_Percent__c >= 0.5 && Down_Payment_Percent__c <= 0.7499, Amount *0.10,

IF(Down_Payment_Percent__c >= 0.75 && Down_Payment_Percent__c <= 0.9999, Amount *0.11,

IF(Down_Payment_Percent__c >= 1 , Amount *0.12,0)))))

Thanks
UC Innovation
Hi Andrew,

I am not sure where the character count is coming from but i am more than happy to help figure this one out. I made some slight modifications to your formula and style. Give this one a try

IF(
AND(
Down_Payment_Percent__c >= 0.1,
Down_Payment_Percent__c < 0.25
),
Amount * 0.08,
IF(
AND(
Down_Payment_Percent__c >= 0.25,
Down_Payment_Percent__c < 0.5
),
Amount * 0.09,
IF(
AND(
Down_Payment_Percent__c >= 0.5,
Down_Payment_Percent__c < 0.75
),
Amount * 0.10,
IF(
AND(
Down_Payment_Percent__c >= 0.75,
Down_Payment_Percent__c < 1
),
Amount * 0.11,
IF(
Down_Payment_Percent__c >= 1,
Amount * 0.12,
0
)
)
)
)
)

Let me know if this one is too long. You can probably get rid of the whitespace before the lines and between the comparisons and expressions to make it even shorter this is just formatted to make it simpler to read but if thats not an issue it should work without the whitespace..

Hope this helps!

AM
Ajay Tated
If  you are using one formula field into another, at a compile time salesforce replaces formula field with the actual formula that is why limit gets hit even if formula seems small.