2

I'm trying to get this formula field to display the correct field for the correct year. The values of the picklist at 2014, 2013, 2012. The related fields are just numbers. There are no syntax errors but it's returning nothing - not even the else result field.

CASE( Commercial_Sales_Year__c, "2014", 
of_commercial_customers_2014__c , "2013", 
of_commercial_customers_2013__c , "2012", 
of_commercial_customers_2012__c, 0)

What am I missing?

2
  • Can you give example of the data you are expecting in Commercial_Sales_Year__c, of_commercial_customers_2014__c, of_commercial_customers_2013__c and of_commercial_customers_2012__c. Also provide the expected output of the formula
    – BarCotter
    Commented May 2, 2014 at 16:49
  • What is the return type of your formula? Text or number? Commented May 5, 2014 at 18:42

1 Answer 1

1

Are you sure you've got your CASE parameters right? Salesforce defines CASE as follows:

CASE(expression,​value1, result1, value2,​ result2,...,​ else_result)

You have a mix of variables and strings that makes it look like you are trying to do

CASE(expression1,result1, expression2, result2, ... else_result)

Also, your else_result parameter is a number, All the other items that look like results are strings. Is that what you intended?

1
  • I think the intention is that the formula should return various fields from the same object depending on the year in the Commercial_Sales_Year__c picklist field. So as long as fields such as of_commercial_customers_2014__c are numbers this should work.
    – Keith C
    Commented May 2, 2014 at 15:26

You must log in to answer this question.

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