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
Terry_0101Terry_0101 

Add numbers in a formula

Each custom field below is a numeric value.  I need a formula that adds these in the following pairs as shown below.  How to only add "Tier__c +  Scope__c", if the other pair is null?  And vice versa?

Health__c +  Priorty__c

Tier__c +  Scope__c 
Best Answer chosen by Terry_0101
kaustav goswamikaustav goswami
IF((Health__c == null && Priorty__c == null),Tier__c +  Scope__c,Health__c +  Priorty__c)

hope this works.

Kaustav

All Answers

kaustav goswamikaustav goswami
IF((Health__c == null && Priorty__c == null),Tier__c +  Scope__c,Health__c +  Priorty__c)

hope this works.

Kaustav
This was selected as the best answer
SwarnasankhaSwarnasankha

Hi Samantha!

The solution suggested by Kaustav will work for you but you need to keep 2 things in mind:

  • The formula field you create to perform the conditional calculation will need to have the "Blank Field Handling" set as "Treat blank fields as blanks" because zero value is not treated as a NULL.
  • You will always need to ensure that either the values for both the fields of a pair are Empty or the values for both the fields of a pair are populated. For example,
    • If Tier__c = NULL, Scope__c = NULL, Health__c = NULL & Priorty__c = 4 then the value of the final formula field will be NULL + 4 which in turn is NULL.
    • If Tier__c = NULL, Scope__c = 2, Health__c = 3 & Priorty__c = 4 then the value of the final formula field will be NULL + 2 which in turn is NULL.

Kind Regards,
Swarna.