0

Receiving the following error if anyone can see where the error is?

Error: Incorrect number of parameters for function 'IF()'. Expected 3, received 2

IF(
    (NOT(ISBLANK(Population__c)) && ((ISPICKVAL(Type__c, "Borough")) || (ISPICKVAL(Type__c, "County")))),
        IF((Population__c / 2) >= 500000, "P10",
        IF((Population__c / 2) >= 250000, "P09",
        IF((Population__c / 2) >= 125000, "P08",
        IF((Population__c / 2) >= 80000, "P07",
        IF((Population__c / 2) >= 40000, "P06",
        IF((Population__c / 2) >= 20000, "P05",
        IF((Population__c / 2) >= 100000, "P04",
        IF((Population__c / 2) >= 5000, "P03",
        IF((Population__c / 2) >= 2000, "P02",
        IF((Population__c / 2) >= 0, "P01",
        NULL)))))))))),


    IF(NOT(ISBLANK(Population__c)) && (NOT(ISPICKVAL(Type__c, "Borough")) || NOT(ISPICKVAL(Type__c, "County"))),
        IF((Population__c) >= 500000, "P10",
        IF((Population__c) >= 250000, "P09",
        IF((Population__c) >= 125000, "P08",
        IF((Population__c) >= 80000, "P07",
        IF((Population__c) >= 40000, "P06",
        IF((Population__c) >= 20000, "P05",
        IF((Population__c) >= 10000, "P04",
        IF((Population__c) >= 5000, "P03",
        IF((Population__c) >= 2000, "P02",
        IF((Population__c) >= 0, "P01", 
        NULL))))))))))),

    IF(ISBLANK(Population__c),
        IF((Total_Budget__c) >= 900000, "B10",
        IF((Total_Budget__c) >= 250000, "B09",
        IF((Total_Budget__c) >= 125000, "B08",
        IF((Total_Budget__c) >= 80000, "B07",
        IF((Total_Budget__c) >= 40000, "B06",
        IF((Total_Budget__c) >= 20000, "B05",
        IF((Total_Budget__c) >= 10000, "B04",
        IF((Total_Budget__c) >= 5000, "B03",
        IF((Total_Budget__c) >= 2000, "B02",
        IF((Total_Budget__c) >= 0, "B01",
        NULL))))))))))),

NULL)
4
  • For issues like these, it helps if you take the time to indent each level of nested function. In the process of doing that, the issue may become apparent.
    – Derek F
    Oct 16 '19 at 21:36
  • I agree with indenting. You should also strive to remove all unnecessary parentheses, as they actually hurt readability for most.
    – Adrian Larson
    Oct 16 '19 at 22:00
  • @AdrianLarson Can I ask what you mean by unnecessary parentheses?
    – Jaspreet
    Oct 16 '19 at 22:41
  • 1
    IF(ISBLANK(Population__c)), is the prob. Oct 16 '19 at 22:43
0

I have to say... crazy calc here. Maybe look for a better way? Perhaps a Process?

Anyway, I can see this error: IF(ISBLANK(Population__c)),

It should be

IF(ISBLANK(Population__c), [all the other nested ifs], NULL)

Note, given the extreme nesting, this calculation could have other issues.

2
  • Thanks guys, let me check it out.
    – Jaspreet
    Oct 17 '19 at 12:30
  • Caspar, I've updated the formula with hopefully better readability and now it's Incorrect number of parameters for function 'IF()'. Expected 3, received 2
    – Jaspreet
    Oct 17 '19 at 14:14

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.