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
BCPEBCPE 

Formula help for calc based on a picklist value

I have an easy one here, I think -- but my track record working with picklists in formulas is not so good.

 

I'm creating a custom field for Quotes to calculate sales tax.

 

I have a picklist field Sales Tax with two values: CA and Out-of-State.  Tax is 9.75% and 0%, respectively.

 

I'm trying to reference that picklist val to calc tax on a qoute's Total Price.

 

ISPICKVAL(Sales_Tax__c, "CA", (TotalPrice * 0.0975), 0)

 

The error I get is:

Incorrect number of parameters for ISPICKVAL(), expected 2 received 4.

 

I'd appreciate any help!

 

Best Answer chosen by Admin (Salesforce Developers) 
flewellsflewells

You're almost there.  Just need to nest ISPICKVAL within an IF statement.  Try this:

 

 IF( ISPICKVAL(Sales_Tax__c, "CA") , (TotalPrice * 0.0975), 0)

All Answers

flewellsflewells

You're almost there.  Just need to nest ISPICKVAL within an IF statement.  Try this:

 

 IF( ISPICKVAL(Sales_Tax__c, "CA") , (TotalPrice * 0.0975), 0)

This was selected as the best answer
BCPEBCPE

Of course, thank you!  Quick side question...

 

If I had, say, 4 picklist vals instead of 2 -- how would I best set that up?  Would I use an "AND" before the "IF"?

 

Appreciate your help!

BE

 

 

flewellsflewells

Assuming the other states have different sales tax %, then you could have something like this...

 

 IF( ISPICKVAL(Sales_Tax__c, "CA") , (TotalPrice * 0.0975),

 IF( ISPICKVAL(Sales_Tax__c, "XX") , (TotalPrice * X.XXXX),

 IF( ISPICKVAL(Sales_Tax__c, "XX") , (TotalPrice * X.XXXX), 0)))

BCPEBCPE

Thanks a million! 

 

BE

Viswa BharathiViswa Bharathi
Hi, if I want to use two picklist value to calculate total price how to manipulate the formula ?