You need to sign in to do that
Don't have an account?
West415
Can you add/sum picklist values?
Hi, I have 4 required picklists on a detail page and each picklist has the values (1,2,3,4,N/A). At the bottom of the page, I have a text input field to hold the total sum of all 4 picklists. I want to add up the values of all the picklists and write it to a another input value on page when the user clicks save. Can this be done?
Yes, this can be done. You need to create a formula field that will sum up the values selected in your picklists. Here is a sample of how the formula will look like:
VALUE(TEXT(Picklist_A__c)) + VALUE(TEXT(Picklist_B__c))
Key here is that you have to first use the TEXT function to convert the picklist value to a Text value, so that it can be used in a formula (without using ISPICKVAL), and then use the VALUE function to convert it back to a Number. Also, your Forumla data type should be Number.
Hope this helps. Let me know how it goes!
Hi West415,
You can use formula field to achieve this type of requirement. Try the following.
It cannot be saved to the input fields like Number/Text data type field, because you are using picklist value for adding.
Try the following,
IF(AND(ISPICKVAL( Amount1__c , 'N/A'),ISPICKVAL( Amount2__c , 'N/A')), null,
IF(ISPICKVAL( Amount1__c , 'N/A'), VALUE( TEXT(Amount2__c)),
IF(ISPICKVAL( Amount2__c , 'N/A'),VALUE( TEXT(Amount1__c)), null )
)
)
In the above example, I have two picklist values Amount1__c and Amount2__c. Amount1__c has the values as 1000, 2800, 2300 and N/A. And Amount2__c has the values 5000, 9100, 8200 and N/A.
So, the above formula checks the two picklist values and if any one of the field has N/A means the other value is given as output to the formula. If both has number values, then it will add those two and give a output.
You need to follow this formula condition for 4 picklist.
Hope this will help you...!
Please give kudos and mark this as a solution, If you found this answer gives you a solution.