I'm trying to add a formula to the matrix report in order to count the number of products in an opportunity. Its not working. I'm getting the following error:

"Error: Invalid custom summary formula definition: Incorrect number of parameters for function 'IF()'. Expected 3, received 4."

Formula that I tried:


1 Answer 1


Try this:



Basic syantx for an If condition is:


You're using an If statement within an If statement. so the synatx would be like this:

if(condition,true,(if criteria does not match then u are checking another if condition) if(condition),true,false)

in your formula, if you can see if the total sum is not zero then you are trying to return Total price value then you are again checking the If condition which is syntactically incorrect

  • please explain to the OP why he is getting this error and why your code should work, otherwise, please post as a comment.
    – glls
    Commented Aug 17, 2017 at 17:19
  • @glls Please check the updated answer.
    – SFDCDJ
    Commented Aug 17, 2017 at 17:29
  • @HUBBY0716 I can see in ur formula u are counting no of products for an opportunity.If you are using matrix report then 'Record Count' which is out of the box field will give you the exact count.You can save ur effort making a new formula.rest is upto u depend on ur requirement.
    – SFDCDJ
    Commented Aug 17, 2017 at 17:32
  • @Dhananjay Patil -> Thx!
    – glls
    Commented Aug 17, 2017 at 17:33

You must log in to answer this question.