1

I am trying to create a formula which will help categorising customers based on the following conditions. I have created this formula which gives me this error " Error: Incorrect number of parameters for function 'IF()'. Expected 3, received 2 " I am sure I am doing something incorrectly here but unable to find out.

IF(Country__c="UK", IF(AND(Field2__c >=100,Field3__c >=35),"A", IF(AND(Field2__c >=100,Field3__c <35),"B", "")))

Thanks in advance

1

I find it easier to format formulas with indents to see how many parameters each function has.

IF(Country__c="UK", 
    IF(AND(Field2__c >=100,Field3__c >=35),
        "A", 
        IF(AND(Field2__c >=100,Field3__c <35),
            "B", 
            ""
        )
    )
)

Looking at it this way, you can see that you don't have a 3rd argument for all your IFs. The IF for Country__c="UK" only has 2. You need to add an else there. I think this should do it.

IF(Country__c="UK", 
    IF(AND(Field2__c >=100,Field3__c >=35),
        "A", 
        IF(AND(Field2__c >=100,Field3__c <35),
            "B", 
            ""
        )
    ),
    "NOT UK"
)
  • Many thanks for your response. You were right that there was no else condition added. I have added it now and it works fine. – user70279 Jul 12 at 14:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.