+ Start a Discussion
Ellsa JamesEllsa James 

How can I assign a numeric value to a text value in a picklist?

I have a picklist with 4 text values. I want to assign a numeric value to each text value. I then want to multiply the chosen value by a number field.  Can anyone help me with the syntax?  

Picklist field = Plan_object__c
Picklist Values = Low,High,Medium,None
Number Field = R_Complex__c 
Best Answer chosen by Ellsa James
Frédéric TrébuchetFrédéric Trébuchet
Hi,

Why don't you simply use a formula field for R_Complex__c?
For example, to assign 1 when picked value is "Low", 2 when "High" and so on, you can have a formula like this one:
IF( ISPICKVAL(Plan_object__c, "Low"), 1, 
  IF( ISPICKVAL(Plan_object__c, "High"), 2,
    IF( ISPICKVAL(Plan_object__c, "Medium"), 3,
      4)))
Hope this helps,
Fred

All Answers

Frédéric TrébuchetFrédéric Trébuchet
Hi,

Why don't you simply use a formula field for R_Complex__c?
For example, to assign 1 when picked value is "Low", 2 when "High" and so on, you can have a formula like this one:
IF( ISPICKVAL(Plan_object__c, "Low"), 1, 
  IF( ISPICKVAL(Plan_object__c, "High"), 2,
    IF( ISPICKVAL(Plan_object__c, "Medium"), 3,
      4)))
Hope this helps,
Fred
This was selected as the best answer
Frédéric TrébuchetFrédéric Trébuchet
Great!
As you have a answer to your question, you should mark it as solved.

Fred