Return to site

Calculate a Currency based on a Picklist Value

Business Problem:

In some cases, businesses might use a Picklist Value to reference a number such as a month, quarter, term, or year. This Picklist value often correlates to a number. Sometimes businesses might want to make a calculation based on this number and an amount field or another currency field.

Formula Solution:

Data Type: Currency

 

IF(
ISPICKVAL( Term__c , "1"), Currency_Field__c * 1,
IF(
ISPICKVAL( Term__c , "2"), Currency_Field__c * 2,
IF(
ISPICKVAL( Term__c , "3"), Currency_Field__c * 3,
IF(
ISPICKVAL( Term__c , "4"), Currency_Field__c * 4
,NULL
)
)
)
)

Let's break this formula down.

An IF() Statement is comprised of three variables, something variables to compare, an action if the variables to compare is true, and an action is the variables to compare is false.

IF(ISPICKVAL( Term__c , "3"), Currency_Field__c * 3,

In this case, the ISPICKVAL( Term__c , "3") is the variable to compare Currency_Field__c * 3 is the action if true. Notice we don't have an action if False set in this example. This is because we have several IF() statements, one for each of the picklist values in your picklist. At the end, you only need one action if all the IF() statements are false. The last thing to remember is to always close all of your statements with closed parentheses and in the example, we have there are 4 close statements.