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
KNKKNK 

Formula field..

Hi Team,

 

I am trying to create a formula filed based on another picklist field value, but it is not populating the value in formula filed.

 

Please find below for the formula and help me here..

 

IF( ISPICKVAL(Product_Mix_GP__c,'<50.00') ,2,
(IF( ISPICKVAL(Product_Mix_GP__c,'50.00-100.00') ,6,
(IF( ISPICKVAL(Product_Mix_GP__c,'100.00-150.00') ,9,
(IF( ISPICKVAL(SYN_Turnover_seeds_CP__c,'150.00-200.00') ,12,
(IF( ISPICKVAL(SYN_Turnover_seeds_CP__c,'>200.00') ,15,0)))))))))

Best Answer chosen by Admin (Salesforce Developers) 
Shannon HaleShannon Hale

Naresh,

 

If all the values are coming from the same picklist, you're better off using a CASE() function instead of the nested IF() calls, like so:

 

CASE( 
  Product_Mix_GP__c,
  "<50.00", 2,
  "50.00-100.00", 6,
  "100.00-150.00", 9,
  "150.00-200.00", 12,
  ">200.00", 15,
  0
)

 

It is easier to read and maintain, and it's more efficient.

All Answers

KNKKNK
****IF( ISPICKVAL(Product_Mix_GP__c,'<50.00') ,2,
(IF( ISPICKVAL(Product_Mix_GP__c,'50.00-100.00') ,6,
(IF( ISPICKVAL(Product_Mix_GP__c,'100.00-150.00') ,9,
(IF( ISPICKVAL(Product_Mix_GP__c,'150.00-200.00') ,12,
(IF( ISPICKVAL(Product_Mix_GP__c,'>200.00') ,15,0)))))))))
KNKKNK
It is Resolved, thanks
Shannon HaleShannon Hale

Naresh,

 

If all the values are coming from the same picklist, you're better off using a CASE() function instead of the nested IF() calls, like so:

 

CASE( 
  Product_Mix_GP__c,
  "<50.00", 2,
  "50.00-100.00", 6,
  "100.00-150.00", 9,
  "150.00-200.00", 12,
  ">200.00", 15,
  0
)

 

It is easier to read and maintain, and it's more efficient.

This was selected as the best answer