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
KidNikiKidNiki 

Formula CASE function not working...

Hello,

 

I have a formula that uses the case function to add up values based on whats selected in a series of picklists:

 

CASE( q1__c , "YES", 1, 0)+CASE( q2__c , "YES", 1, 0)+CASE( q3__c , "YES", 1, 0)+CASE( q4__c , "YES", 1, 0)

 It does nothing and the formula field always comes back as 0, regardless of what I have selected.  Can anyone help me??

 

Thank you

Andy BoettcherAndy Boettcher

What kind of fields are the q(x)__c?  Text?  Checkbox?

 

-Andy

KidNikiKidNiki

They are picklist fields.  If I set a few (1 or 2) to "YES" and leave the rest alone, I would think that formula field would evalutate to the sum of all the "YES" fileds but it just stays at 0.

 

Andy BoettcherAndy Boettcher

I just created:

 

3 Picklist fields - q1, q2, q3 with "YES" and "NO" as options - I also set one of them with "yes" and "no" to make sure SF isn't case-sensitive in the formula logic you started with.

 

My formula field is Formula(Type Number) with 0 decimal places.  The formula logic is:

CASE( q1__c , "YES", 1, 0) + CASE( q2__c, "YES", 1,0) + CASE( q3__c, "YES", 1,0)

 

Works like a charm for me?

 

-Andy

 

KidNikiKidNiki

So you got 3 as the answer then?  Okay, thank you again for your help!

Andy BoettcherAndy Boettcher

Yup - tried all kinds of combinations...setting ones as "yes", some as "no", one as "none"...it all parsed out as expected.

 

Only thing I didn't know from your setup was the kind of Formula field you chose - was it Number?

 

-Andy