0

I need to create a complex formula, which sums fields based on picklist values.

My fields are as follows:

Picklist1__c : Val1, Val2
Picklist2__c : Val1, Val2
Picklist3__c : Val1, Val2

Number1__c
Number2__c
Number3__c

Total_Amount__c 

The first three fields are my picklist fields, the next fields hold a number and Total_Amount__c is the formula field that I need to create. The formula needs to add all numbers, where the corresponding picklist value has Val1 selected. Example:

Picklist1__c: Val1
Number1__c: 100

Picklist2__c: Val2
Number2__c: 50


Picklist3__c: Val3
Number3__c: 30

The result for Total_Amount__c should be: 130.

Is there an easy way to express this in a formula?

Tia, Lily.

0

The solution I found to this problem is:

    IF(PICKVAL(Picklist1__c,"Val1"), Number1__c,0)
    +
    IF(PICKVAL(Picklist2__c,"Val1"), Number2__c,0)
    +
    IF(PICKVAL(Picklist3__c,"Val1"), Number3__c,0)

This seems to work. I wonder whether there is a better solution.

|improve this answer|||||

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.