Facing Issue in formula

I am new in coding and I am trying to learn formulas.

For the below formula:

``````IF
(
AND
Min_Pay__c*0, Max_Pay__c,

IF(
AND(IsInfected__c==TRUE, IsCured__c==TRUE)
,Max_Pay__c,Min_Pay__c))
``````

I get following Error:

Incorrect number of parameters for function 'IF()'. Expected 3, received 4. If I add one more parentheses, it shows me another error ' Syntax error. Extra ')'

please re - phrase the formula

above formula will achieve the below use cases:

use case 1 : if patient is infected and dead, no payment

use case 2 : if patient is infected and cured, either pay maximum or minimum based on the treatment.

hope this helps

• Yeah Shivaraman, I got the answer. I also removed Max_Pay__c from my first condition and achieved what I wanted. Commented May 15, 2020 at 20:33
• There is never a need to compare a Boolean value to TRUE. You can just use the name of the Boolean value. Commented May 23, 2020 at 14:22

If statements require three parameters, the condition, the value if true, then the value if false. You have four parameters.

2. Min_Pay__c*0
3. Max_Pay__c
4. IF( AND(IsInfected__c==TRUE, IsCured__c==TRUE) ,Max_Pay__c,Min_Pay__c)

I'm not sure what you meant to do, but you have an extra value you need to get rid of.

Also, a Boolean value is already a Boolean value, so you can simply say:

• IsInfected__c
• IsCured__c

Rather than comparing the value to TRUE.

• I am just trying to do if Patient is infected and if he is dead, then he should not pay anything, if patient is infected and he is cured then he should max pay. I removed "True" from the boolean, but is giving me same error. Commented May 15, 2020 at 19:13