2

I have a picklist field that has the value of either "A" or "B"

If it is A, I need to take the value of a number field ("d") and based on the number ranges within that field, set the formula field to a tier 1 through 5. If it is B, I need to take the value of a number field ("c") and based on number ranges within that field, set the formula field to a tier 1 through 5.

I've tried variations of the following, but all of them show errors of one kind or another.

Any help is greatly appreciated.

AND( ISPICKVAL(Industry , "A")),

IF(d >= 201 , "Tier 1", 
IF(d >= 151, "Tier 2", 
IF(d >= 101, "Tier 3",  
IF(d >= 51, "Tier 4", 
IF(d >= 1 , "Tier 5", 
NULL)))))),

OR(
AND( ISPICKVAL(Industry , "B")),

IF(c >= 100000, "Tier 5",  
IF(c>= 40000, "Tier 4",  
IF(c>= 20000 , "Tier 3",  
IF(c>= 10000, "Tier 2",   
IF(c<= 9999 , "Tier 1", 

NULL)))))
)
1
  • Thank you for answering, I did try this variation, (and I also put in yours with the correct fields just in case) but still had this error: Error: Incorrect number of parameters for function 'IF()'. Expected 3, received 2
    – user7843
    Apr 11, 2014 at 16:20

2 Answers 2

1

Try using CASE. It's less compile sized than IF

CASE( TestPickList__c , "A",  
    IF(d >= 201 , "Tier 1", 
IF(d >= 151, "Tier 2", 
IF(d >= 101, "Tier 3",  
IF(d >= 51, "Tier 4", 
IF(d >= 1 , "Tier 5", 
NULL)))))
, "B",
    IF(c >= 100000, "Tier 5",  
IF(c>= 40000, "Tier 4",  
IF(c>= 20000 , "Tier 3",  
IF(c>= 10000, "Tier 2",   
IF(c<= 9999 , "Tier 1", 

NULL))))) ,"")
1
  • Glad to help you! Play around CASE, it's very easy to manage(in a readable way) a formula
    – highfive
    Apr 11, 2014 at 16:59
0

Your usage of AND and OR seems not correct. What about this (untested):

IF( ISPICKVAL(Industry , "A"),

IF(d >= 201 , "Tier 1", 
IF(d >= 151, "Tier 2", 
IF(d >= 101, "Tier 3",
IF(d >= 51, "Tier 4", 
IF(d >= 1 , "Tier 5", 
""))))),

IF(ISPICKVAL(Industry , "B"),

IF(c >= 100000, "Tier 5",
IF(c>= 40000, "Tier 4",
IF(c>= 20000 , "Tier 3",
IF(c>= 10000, "Tier 2",
IF(c<= 9999 , "Tier 1",
"")))))))

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .