0

I have nested IF statements, and the first IF statement is correctly returning "Yes" when a record type does not have all of the values present, but the second IF statement - written the same way - does not seem to correctly return a YES. What could be wrong?

IF(
    AND(
        OR(
            Record_Type_Name__c = "Record Type 1",
            Record_Type_Name__c = "Record Type 2",
            Record_Type_Name__c = "Record Type 3",
            Record_Type_Name__c = "Record Type 4"
        ),
        OR(
            ISNULL(Number_of_Employees__c),
            ISNULL(TEXT(Industry__c)),
            ISNULL(Current_LPM__c),
            ISNULL(TEXT(Accepts_Online_Payments__c)),
            ISNULL(TEXT(Current_Payments_Solution__c))
        )
    ),
    "YES",
    IF(
        AND(
            OR(
                Record_Type_Name__c = "Record Type 5",
                Record_Type_Name__c = "Record Type 6",
                Record_Type_Name__c = "Record Type 7",
                Record_Type_Name__c = "Record Type 8"
            ),
            OR(
                ISNULL(TEXT(Industry__c)),
                ISNULL(Number_of_Employees__c)
            )
        ),
        "YES",
        "NO"
    )
)
9
  • Please include examples of input that give you the incorrect result. Also, below the area where you enter your formula, what option do you have selected for handling null/blank values (treat blanks as blanks, or treat blanks as zeros)?
    – Derek F
    Commented Jan 9 at 20:25
  • The input I gave the formula was Record Type 5, Industry was null but No. of Employees was completed. Options for handling null / blank values = treat blanks as blanks - where that is an option. Commented Jan 9 at 20:38
  • Like I said, it's an option that appears below the part of the screen where you would enter that formula (when you are editing what I assume is a formula field). Are you certain that Industry__c is null? That is, the automatic --None-- option is selected when you go to edit the record, and not a similar-looking picklist value like None (without the two dashes on both sides). I'm assuming Industry__c is a picklist, but I'd like you to confirm or deny that.
    – Derek F
    Commented Jan 9 at 20:45
  • Yes Industry is null, Yes it is a picklist field - the automatic "--None--" is the option selected Commented Jan 9 at 20:54
  • 1
    I'm about out of ideas at this point. The next step I'd take is to strip out the parts of the formula that you know work (i.e. the outermost IF()) and keep paring it down one thing at a time until you get a better idea of what is causing the issue. That, or start working from the bottom-up (start with IF(OR(ISNULL(TEXT(Industry__c)), ISNULL(Number_of_Employees__c)), 'yes', 'no'). Maybe try ISBLANK() instead of ISNULL().
    – Derek F
    Commented Jan 9 at 22:19

1 Answer 1

1

Updated the formula to ISBLANK expressions and this solved the problem.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .