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
Steve Gilbert 13Steve Gilbert 13 

Using an "If.And" formula to calculate a commission value

Trying to come up with a way to use the If And combination in a calculation. I have the following

IF( 
   And (Buyer_Present__c = false,
       ( CONTAINS(Commission__r.Name,"Ticket Commission")),
            (125 - Commission__r.Amount_to_Pay__c),
0)
)

All I am trying to get it to do is calculate the difference the dollor value of  (125 - Commission__r.Amount_to_Pay__c) when those conditions are true.
Best Answer chosen by Steve Gilbert 13
SARI4SARI4
There is some Error in placing closing bracket for AND, your calculation statement is inside AND.
You can try below formula
IF(Buyer_Present__c = false, 
	IF(CONTAINS(Commission__r.Name,"Ticket Commission"), (125 -Commission__r.Amount_to_Pay__c), 0),
	
	0)

OR
 
IF( 
       AND (Buyer_Present__c = false, CONTAINS(Commission__r.Name,"Ticket Commission")),
       125 - Commission__r.Amount_to_Pay__c,
	   0)

​​​​​​​

All Answers

Steve Gilbert 13Steve Gilbert 13
the error is "Error: Incorrect parameter type for function 'And()'. Expected Boolean, received Number"
SARI4SARI4
There is some Error in placing closing bracket for AND, your calculation statement is inside AND.
You can try below formula
IF(Buyer_Present__c = false, 
	IF(CONTAINS(Commission__r.Name,"Ticket Commission"), (125 -Commission__r.Amount_to_Pay__c), 0),
	
	0)

OR
 
IF( 
       AND (Buyer_Present__c = false, CONTAINS(Commission__r.Name,"Ticket Commission")),
       125 - Commission__r.Amount_to_Pay__c,
	   0)

​​​​​​​
This was selected as the best answer
Steve Gilbert 13Steve Gilbert 13
Thank you. I was finally able to get it as well just as I got the email on your reply.