function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
666Chicago666Chicago 

What's wrong with my margin formula?

I'm getting the following error message for the formula I build below which I don't understand."Error: Compiled formula is too big to execute (4,074 characters). Maximum size is 4,000 characters" By my count I have 159 characters!

The formula I've created is trying to figure out the margins between what the end user (customer) pays 2nd tier (reseller) and what 2nd tier pays the 1st Tier (distributor). The formula also need to take into consideration that sometimes there may not be 2nd Tier (reseller) and that the 1st Tier sells directly to the end user (customer).
I'm using a what if statement in case there is no 2nd Tier. Do I have my formula right?

FORMULA
IF( ISNULL( {!New_2nd_Tier_Margin__c}) , (1.00-({!New_1st_Tier_Cost__c} / {!
New_End_User_Cost__c} )), (1.00-({!New_1st_Tier_Cost__c} / {!New_2nd_Tier_Cost__c} )))
 
thanks,
666Chicago
TonkaCruiserTonkaCruiser
The 4000 isn't an actual character count, you are limited to 1000 characters and 4000 code characters.  The system takes the text functions that you input and converts it to code.  That code is normally larger than your text format.  It also takes the formula from any source fields and adds them to the value, this is what I think your running into.  There isn't any way to get around this except to try and reduce the size of your formulas.  You are only 74 characters off so shouldn't be too hard.  Look at your source fields and see if your can shorten them up some.  If you have any issue, post all the formulas and we can see if there is any way to reduce the size.
 
Chris