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
Liz CarterLiz Carter 

Currency Formula Field on Opportunity

I'm trying to write a formula field on Opportunity object involving 2 fields - Amount, and a custom number field, License_Period_months__c. The goal is to calculate an amount based on 3 different scenarios of contract length:

Logic:
 
If
License_Period_months__c = 12, Amount
 
If
License_Period_months__c = 24, Amount * 2 * .15
 
If
License_Period_months__c = 36, Amount * 3 * .30

I am not sure of the correct way to write the formula involving the IF statements, as I keep getting errors. I'm attempting to do this on a formula (currency) field type on opp. thanks!
Gregoire SaintenacGregoire Saintenac
Hi Liz , you should use a Case() function in your formula :
https://help.salesforce.com/articleView?id=customize_functions_a_h.htm&type=5
CASE(License_Period_months__c, 12, Amount * 2 * .15...

Else you have to put If in if -> 
IF(logical_test, value_if_true, IF(logical_test, value_if_true, IF(logical_test, value_if_true, value_if_false))) ...

 
Steven NsubugaSteven Nsubuga
if (License_Period_months__c = 12, Amount,
 if (License_Period_months__c = 24, Amount * 2 * .15, 
	if (License_Period_months__c = 36, Amount * 3 * .30, 0
 ))
)

 
MUHAMMED SEMIN P NMUHAMMED SEMIN P N
Hi Liz,
IF(License_Period_months__c=12,TEXT(FLOOR(Amount)) & ","," ")&
IF(License_Period_months__c=24,TEXT(FLOOR(Amount*2*0.15)) & ","," ")&
IF(License_Period_months__c=36,TEXT(FLOOR(Amount*3*0.30)) & ","," ")
hope this will help you, if it solve your problem please mark it as a "best answer" !!!
thank you,
 
Liz CarterLiz Carter
Thank you all for the feedback, very much appreciated, and I will dig into these answers today!