[SalesForce] Sum Two Customer Formula Fields

Is there a way to sum the value from two custom formula fields into a separate formula field? I am trying to set up a prospect score in Salesforce based on the customer's lead source. Due to the large number of possible lead sources, I could not put this formula in one field (it exceeded the 5,000 character limit). As a result I split the formula in two and put it in two separate fields. Now, I would like to add them together. However when I add put (Leadscore1__c + Leadscore2__c) in my new field, Salesforce still tells me that my formula is too long. Is there a way to add the values of these two fields together?

Best Answer

Is there a way to sum the value from two custom formula fields into a separate formula field?

Yes.

You can just create another Formula field and add the other Formula Fields as you would do with any other field.

E.g., if I have two Formula fields as:

  • Formula1__c
  • Formula2__c

I can always create another Formula field say Formula 3 and use the other two fields in my formula editor, something as below.

Formula1__c + Formula2__c

For limits issue, I would imagine that your other two formula fields already are near to the limits and thus when you combine it in a new formula, you run into issues.

You may like to refer to the TIPS FOR REDUCING FORMULA SIZE in this documentation which explains with examples to reduce the formula compile time size.

To correct formula limit errors, move parts of the formula into one or more secondary formula fields, and reference those in your main formula. The secondary fields don’t need to appear on the page layout.

And if everything fails:

If all else fails, use a workflow field update

The document explains on the approaches as how you can reduce either your formula size or can utilize a workflow field update here.

Related Topic