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
Chris McCoy 6Chris McCoy 6 

Syntax error on formula

I'm new to Salesforce and I'm having issues with a formula to calculate fees based on number of units. The current formula is simple and works.
if(Account.Units_NA__c>0,
if(Account.Units_NA__c>50,
46000+(Account.Units_NA__c-50)*200,46000),Null)
If the units are less than 50,  it is null, if they are greater than 50, it is 46000 plus 200 for each unit over 50 - otherwise display 46000.
There is new criteria - we have multiple specialties and one of them has a different fee calculation. I tried multiple times to add that criteria and calculation but I keep getting errors - to add a ) or remove a , but I just can't make it work. I think I've butchered it so much that it doesn't bear any resemblance to what it should look like. Any help will be greatly appreciated!
if(Account.Units_NA__c>0,
if(Account.Units_NA__c>50,
46000+(Account.Units_NA__c-50)*200,46000),Null)
or(if(ispickval( Account.Specialty_Branding_NA__c ,"Best"),
If(Account.Units_NA_c> 0,
If(Account.Units_NA_c > 200,
20000+(Account.Units_NA__c-200)*5,20000)))

 
Best Answer chosen by Chris McCoy 6
Deepak GulianDeepak Gulian
If(ispickval( Account.Specialty_Branding_NA__c ,"Best"),
  If(Account.Units_NA_c> 0,
  If(Account.Units_NA_c > 200,
  20000+(Account.Units_NA__c-200)*5,20000),Null)
,
  if(Account.Units_NA__c>0,
  if(Account.Units_NA__c>50,
  46000+(Account.Units_NA__c-50)*200,46000),Null)
)

Try this!

All Answers

Deepak GulianDeepak Gulian
What criteria you trying to match up in below formula
if(Account.Units_NA__c>0,
if(Account.Units_NA__c>50,
46000+(Account.Units_NA__c-50)*200,46000),Null)
or(if(ispickval( Account.Specialty_Branding_NA__c ,"Best"),
If(Account.Units_NA_c> 0,
If(Account.Units_NA_c > 200,
20000+(Account.Units_NA__c-200)*5,20000)))

Explain it?
Deepak GulianDeepak Gulian
If(ispickval( Account.Specialty_Branding_NA__c ,"Best"),
  If(Account.Units_NA_c> 0,
  If(Account.Units_NA_c > 200,
  20000+(Account.Units_NA__c-200)*5,20000),Null)
,
  if(Account.Units_NA__c>0,
  if(Account.Units_NA__c>50,
  46000+(Account.Units_NA__c-50)*200,46000),Null)
)

Try this!
This was selected as the best answer