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
Mikey999Mikey999 

Need help with formula.

I have the following code.

IF(OR( Hunkeler_Opportunity__c,  Mailing_Systems_Opportunity__c), 0.5, IF( Amount < 40000, 0, IF( Amount < 80000, 0.3, IF( Amount < 150000, 0.4, 0.5))))

 

As you know the first line says if this is a Hunkeler Opporuntiy or mailin.. then use the first fomula.. That was easy.. Now I have another field called billing_type_c that if this is set to Direct Sale then it should use the first calculation also.  I just can't get the syntax right.. As you can tell I don't do this often at all .. So I greatly appreciate help.

 

Thanks!

Best Answer chosen by Admin (Salesforce Developers) 
Mikey999Mikey999
I got it to work by doing this..

IF(OR( Hunkeler_Opportunity__c, Mailing_Systems_Opportunity__c, ISPICKVAL(Billing_Type__c, "Direct Sale")), 0.5, IF( Amount < 40000, 0, IF( Amount < 80000, 0.3, IF( Amount < 150000, 0.4, 0.5))))

All Answers

Mikey999Mikey999
Just an FYI.. The billing_type_c is a picklist.. I think that puts hair on the situation.. Thanks
ManoharSFManoharSF

Mike, I dint get what your requirement is but if its picklist then you can use ISPICKVAL(picklist_field, text_literal).

 

ManoharSFManoharSF
Like

IF(ISPICKVAL(billing_type_c, "Direct Sale"), IF(OR( Hunkeler_Opportunity__c, Mailing_Systems_Opportunity__c), 0.5, IF( Amount < 40000, 0, IF( Amount < 80000, 0.3, IF( Amount < 150000, 0.4, 0.5)))), <what ever you want when billing_type_c<> "Direct Sale">)
Mikey999Mikey999
So I need the picklist value of Direct Sale to also = 0.5 as does Hunkeler and Mailing.

IF(ISPICKVAL(billing_type_c, "Direct Sale"), IF(OR( Hunkeler_Opportunity__c, Mailing_Systems_Opportunity__c), 0.5, IF( Amount < 40000, 0, IF( Amount < 80000, 0.3, IF( Amount < 150000, 0.4, 0.5)))), <what ever you want when billing_type_c<> "Direct Sale">) ---< So would I put 0.5 here? then a close )?
Mikey999Mikey999

So I tried this and the syntax is good b.. but it returns 0.. In the field.

 

IF(ISPICKVAL(Billing_Type__c, "Direct Sale"), IF(OR( Hunkeler_Opportunity__c, Mailing_Systems_Opportunity__c), 0.5, IF( Amount < 40000, 0, IF( Amount < 80000, 0.3, IF( Amount < 150000, 0.4, 0.5)))),0.5)

Mikey999Mikey999
I got it to work by doing this..

IF(OR( Hunkeler_Opportunity__c, Mailing_Systems_Opportunity__c, ISPICKVAL(Billing_Type__c, "Direct Sale")), 0.5, IF( Amount < 40000, 0, IF( Amount < 80000, 0.3, IF( Amount < 150000, 0.4, 0.5))))
This was selected as the best answer