Ask Search:
Jill HeffernanJill Heffernan 

I would like to update a fied based on the value selected in a picklist

I have a picklist field with about 10 options. Each option should correspond to a specific % number.  What is the best way to have a field update with the correct % based on the picklist option selected?
Example:
Option A should update new field with 10%
Option B should update new field with 20%
Option C should update new field with 30%
Etc....
Best Answer chosen by Jill Heffernan
Chris GardnerChris Gardner

Does it need to actually write data to a new field, or can you use a formula field for the percentages?

If you can use a formula, a CASE statement should work well:
 

CASE({!Custom_Field__c},
"Option A", 10,
"Option B", 20,
"Option C", 30,
...
0)

All Answers

Chris GardnerChris Gardner

Does it need to actually write data to a new field, or can you use a formula field for the percentages?

If you can use a formula, a CASE statement should work well:
 

CASE({!Custom_Field__c},
"Option A", 10,
"Option B", 20,
"Option C", 30,
...
0)
This was selected as the best answer
Umair JavaidUmair Javaid
Hi Jill,

You could create a formula field with the type of Percent and use the following formula:
 
CASE(Picklist_field__c,
"Option A", 0.1,
"Option B", 0.2,
"Option C", 0.3,
...
"Option J", 1,
null)

 
Steve MolisSteve Molis
What is the datatype of the other field?

Is it a Datatype = Percent? 
or is it a Datatype = Formula with a Percent result?  

Your basic Formula would be something like this
 
CASE(Option ,
"A", 0.10,
"B", 0.20,
"C", 0.30,
"D", 0.40,
"E", 0.50,
"F", 0.60,
"G", 0.70,
"H", 0.80,
"I", 0.90,
"J", 1.00,
0)

 
Jill HeffernanJill Heffernan
Thank you! This formula worked, just needed the correct percent in the field.
Steve MolisSteve Molis
PS.  Percent values are stored as decimals, not whole numbers.

For example 
0.10 = 10% 
1 = 100%
10 = 1,000%