0

I dived into a nested if statement and it's now way over my head. Could you please take a look and let me know why it doesn't work?

All I wantis to categorize our accounts based on multiple criteria. Region, Sector and later on the number of employees. But i've been at it for 2 hours to no avail...

IF(
ISPICKVAL(Sector__c, "Supplier/Distributor"), 
"Supplier", 
IF(
    ISPICKVAL(Account_Region__c , "Middle East"), 
    "Middle East",
    IF(
        ISPICKVAL(Account_Region__c , "Americas"), 
        IF(
            BEGINS(TEXT(Sector__c) , "Restaurants"),
            "US Restaurants", 
            "US Hotels"
        ), 
            IF(
                 AND(NumberOfEmployees < 100, Account_Region__c, "UK"), "Independents"
                IF( 
                     AND(NumberOfEmployees >= 100, NumberOfEmployees < 1750), "UK - SMB",
                   IF(
                       NumberOfEmployees >= 1750, "UK - C&E", "ERROR"
                   )
                )
            )

    )
  )
)

The error message reads:

Error: Syntax error. Missing ')'

I would be very grateful if someone could help me find the gap!

Thanks,

Csongor

  • I don't have the time to dive into this but did notice something that i think is off: AND(NumberOfEmployees < 100, Account_Region__c, "UK"). That probably should be AND(NumberOfEmployees < 100, Account_Region__c ="UK"). Could be that it fixes your problem, but might not. – Kasper May 25 '18 at 9:21
3

You're missing one comma.

IF(
ISPICKVAL(Sector__c, "Supplier/Distributor"), 
"Supplier", 
IF(
    ISPICKVAL(Account_Region__c , "Middle East"), 
    "Middle East",
    IF(
        ISPICKVAL(Account_Region__c , "Americas"), 
        IF(
            BEGINS(TEXT(Sector__c) , "Restaurants"),
            "US Restaurants", 
            "US Hotels"
        ), 
            IF(
                 AND(NumberOfEmployees < 100, Account_Region__c, "UK"), "Independents",
                IF( 
                     AND(NumberOfEmployees >= 100, NumberOfEmployees < 1750), "UK - SMB",
                   IF(
                       NumberOfEmployees >= 1750, "UK - C&E", "ERROR"
                   )
                )
            )

    )
  )
)

After AND(NumberOfEmployees < 100, Account_Region__c, "UK"), "Independents"

| improve this answer | |
  • That's so embarrassing! Thank you for your help :) – Csongor May 25 '18 at 10:52

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.