You've got maybe, four options:
- Move any other formulas to workflow
- Move any other formulas to an apex trigger/batch class
- Reduce the number of references to external formulas in this formula
- Move this formula to workflow rule/trigger
Without seeing the details of the other fields in the formula (
Overall_Gap_div2_exact__c) its hard to tell exactly where things should be moved. I'm guessing these are very large, complex formulas, since the actual formula in the question is rather small.
Since the second half of your
IF results both do the same math, you can move the math outside of the formula, reducing the number of formula references in total.
Each field which results in a formula adds the full characters of all formulas they reference & themselves, so calling a field with a large size more than once gets very expensive. By removing half of our formula references, we should be able to drastically lower the size of the formula. About half of 9k is 4.5, so that should get you closer to the 5k limit.
ISPICKVAL(Louvre_Calculator__c, "215mm Louvre Calculator"),
+ (Overall_Gap_div2_exact__c / 2)
) - PCL__c
The returned number from the
IF is used by the rest of the formula. Its determined, then we do some math on the result.
PS: Next time you ask about improving a formula, some schema information about the referenced fields would be useful. The raw formulas don't need to be included, but the size of each formula should be.
You can get the formula size by going to the page, clicking edit, and then under "Advanced formula editor", click "Check Syntax". It gives you a size in the output. Knowing the size of each field, and which fields are formulas would have improved the ability of myself & others to answer your question.