1

I am getting the below error for the below formula code -

IF( Risk_Score__c >=3.2,'High',
IF( Risk_Score__c >=0.8 && Risk_Score__c<3.2,'Moderate','Low'
))

Error - Compiled formula is too big to execute (13,642 characters). Maximum size is 5,000 characters

Risk_Score__c is a formula field with below formula -

IF(TEXT(Likelihood__c) == 'Always' && TEXT(Impact__c) =='Extreme Harm', 16,
if(TEXT(Likelihood__c) == 'Always' && TEXT(Impact__c) =='Very Serious Harm', 8,
if(TEXT(Likelihood__c) == 'Always' && TEXT(Impact__c) =='Serious Harm', 4, 
if(TEXT(Likelihood__c) == 'Always' && TEXT(Impact__c) =='Minor Harm', 2, 
if(TEXT(Likelihood__c) == 'Always' && TEXT(Impact__c) =='No Significant Harm', 1, 
if(TEXT(Likelihood__c) == 'Very Likely' && TEXT(Impact__c) =='Extreme Harm', 12.8, 
if(TEXT(Likelihood__c) == 'Very Likely' && TEXT(Impact__c) =='Very Serious Harm', 6.4, 
if(TEXT(Likelihood__c) == 'Very Likely' && TEXT(Impact__c) =='Serious Harm', 3.2, 
if(TEXT(Likelihood__c) == 'Very Likely' && TEXT(Impact__c) =='Minor Harm', 1.6, 
if(TEXT(Likelihood__c) == 'Very Likely' && TEXT(Impact__c) =='No Significant Harm', 0.8,
if(TEXT(Likelihood__c) == 'Likely' && TEXT(Impact__c) =='Extreme Harm',9.6,
if(TEXT(Likelihood__c) == 'Likely' && TEXT(Impact__c) =='Very Serious Harm',4.8,
if(TEXT(Likelihood__c) == 'Likely' && TEXT(Impact__c) =='Serious Harm',2.4,
if(TEXT(Likelihood__c) == 'Likely' && TEXT(Impact__c) =='Minor Harm',1.2,
if(TEXT(Likelihood__c) == 'Likely' && TEXT(Impact__c) =='No Significant Harm',0.6,
if(TEXT(Likelihood__c) == 'Infrequent' && TEXT(Impact__c) =='Extreme Harm',6.4,
if(TEXT(Likelihood__c) == 'Infrequent' && TEXT(Impact__c) =='Very Serious Harm',3.2,
if(TEXT(Likelihood__c) == 'Infrequent' && TEXT(Impact__c) =='Serious Harm',1.6,
if(TEXT(Likelihood__c) == 'Infrequent' && TEXT(Impact__c) =='Minor Harm',0.8,
if(TEXT(Likelihood__c) == 'Infrequent' && TEXT(Impact__c) =='No Significant Harm',0.4,
if(TEXT(Likelihood__c) == 'Remote' && TEXT(Impact__c) =='Extreme Harm',3.2,
if(TEXT(Likelihood__c) == 'Remote' && TEXT(Impact__c) =='Very Serious Harm',1.6,
if(TEXT(Likelihood__c) == 'Remote' && TEXT(Impact__c) =='Serious Harm',0.8,
if(TEXT(Likelihood__c) == 'Remote' && TEXT(Impact__c) =='Minor Harm',0.4,
if(TEXT(Likelihood__c) == 'Remote' && TEXT(Impact__c) =='No Significant Harm',0.2,
0
)))))))))))))))))))))))))

enter image description here

  • 1
    is Risk_Score__c also a formula field ? can you post the formula of the Risk_Score__c field as well ? – Vamsi Krishna Apr 20 '15 at 9:37
  • You would also need to include any formula fields that are used in Risk_Score__c as well. – BarCotter Apr 20 '15 at 9:39
  • It is too long to post it. I have written like this below: - IF(TEXT(Likelihood__c) == 'Always' && TEXT(Impact__c) =='Extreme Harm', 16, if(TEXT(Likelihood__c) == 'Always' && TEXT(Impact__c) =='Very Serious Harm', 8, if(TEXT(Likelihood__c) == 'Always' && TEXT(Impact__c) =='Serious Harm', 4, – hellraizer Apr 20 '15 at 9:48
  • I need to have 30 coimbinations like the above code.. – hellraizer Apr 20 '15 at 9:50
  • If you click edit on your question you can post it there – BarCotter Apr 20 '15 at 9:52
2

You need to make the formula a bit smarter. Looks like there are some fixed factors that you are using in the calculating. Why not do something like this:

CASE(TEXT(Likelihood__c),
'Always',1,
'Very Likely',0.8,
etc.......,
0
)
*
CASE(TEXT(Impact__c),
'Extreme Harm',16,
'Very Serious Harm',8,
etc.......,
0
)

Also in the result field try to reduce the amount of references to Risk_Score__c. Each reference will again add the complete size of Risk_Score__c to the total. E.g. use CASE there or reduce by 33% by doing 1 less reference:

IF( Risk_Score__c >=3.2,'High',
IF( Risk_Score__c <0.8,'Low','Moderate'
))
| improve this answer | |
0

You could do something like what is shown below (it is untested), which uses CASE. This will give you the same output as your formula.

CASE(TEXT(Impact__c),
    'Extreme Harm', 3.2,
    'Very Serious Harm', 1.6,
    'Serious Harm', 0.8,
    'Minor Harm', 0.4,
    'No Significant Harm', 0.2,
    0
)
*
CASE(TEXT(Likelihood__c),
    'Remote', 1,
    'Infrequent', 2,
    'Likely', 3,
    'Very Likely, 4,
    'Always', 5,
    0
)

From looking at your code I can see that the Impact__c produces a set of values and the Likelihood__c adds a weight to those values.

For example 'Extreme Harm' is a value of 3.2. When the Likelihood__c changes the value increases:

  • 'Remote' = 3.2 x 1 = 3.2
  • 'Infrequent' = 3.2 x 2 = 6.4
  • 'Likely' = 3.2 x 3 = 9.6
  • 'Very Likely = 3.2 x 4 = 12.8
  • 'Always' = 3.2 x 5 = 16
| improve this answer | |
  • 1
    I think they are probably picklist values, so you probably do need to wrap them in Text() – Caspar Harmer Apr 20 '15 at 10:16
  • Hi. I need a combination of Likelihood__c & Impact__c.. – hellraizer Apr 20 '15 at 10:26
  • Thanks @CaspNZ I have updated my question. This formula will give the exact same output as yours. – BarCotter Apr 20 '15 at 10:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.