+ Start a Discussion
Amanda JonesAmanda Jones 

Decrease compile size of formula using mulitple IF statements

Hello!

I have written a formula and now need to condense it to get it to run in my org. I think the CASE function may help me here, but am not sure how to write it.

Here is the current statement:

IF(NOT(ISPICKVAL(Country__c,"Costa Rica")),
STMAmountBase__c-450,

IF(
 BEGINS(Name, "Micro-trip"),STMAmountBase__c-90,
STMAmountBase__c-275))

The compile size is  (5,557 characters). I need it be 5000 or less of course. 

Looking for bigger brains than mine. :)

Thanks!
Best Answer chosen by Amanda Jones
James LoghryJames Loghry
Are you referencing formula fields here as well?  I don't see how this formula alone could be over 5000 characters :)

I would try using STMAmountBase__c just once and refactoring the formula to remove the NOT function:
 
STMAmountBase__c - IF(
    ISPICKVAL(Country__c,"Costa Rica"),
    IF(BEGINS(Name,"Micro-trip"),90,275),
    450
)

 

All Answers

James LoghryJames Loghry
Are you referencing formula fields here as well?  I don't see how this formula alone could be over 5000 characters :)

I would try using STMAmountBase__c just once and refactoring the formula to remove the NOT function:
 
STMAmountBase__c - IF(
    ISPICKVAL(Country__c,"Costa Rica"),
    IF(BEGINS(Name,"Micro-trip"),90,275),
    450
)

 
This was selected as the best answer
Amanda JonesAmanda Jones
Hi James, yes I am referencing formula fields. This was the perfect solution. Thank you!