Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
3 years ago
Solved

"Nested" if struggle

I'm struggling to create an If with a desired end result of "Yes" or "No"

We have 4 categories to test for in a text field,

"" (i.e. blank)

[Fred Flintstone: 31/03/2022]

a character string that contains "deleted or reassigned"

a character string that does not contain "deleted or reassigned"

 

For the first 3 tests I would expect a result of "No" and "Yes" on the last test.  Fred Flintstone is a testing name, not a real employee, we've moved on from the stone age 🙂

 

The IF statement I came up with is as follows, but keeps giving an error advising too few arguments for the If, but I can't see what's wrong with it

RejectedLine = IF(TableName[TextField]="" ||
                IF(SEARCH("]",TableName[TextField],,0)=LEN(TableName[TextField]) ||
                IF(CONTAINSSTRING(TableName[TextField],"deleted or reassigned")),
                "No","Yes"))
 
Any help gratefully received
Regards
Fred
  • Anonymous Try:

    RejectedLine = IF(TableName[TextField]="" ||
                    SEARCH("]",TableName[TextField],,0)=LEN(TableName[TextField]) ||
                    CONTAINSSTRING(TableName[TextField],"deleted or reassigned"),
                    "No","Yes")

2 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    Greg_Deckler perfect, of course, no need for the multiple "IF", this isn't Excel 🙂

    RThanks and regards

    Fred

  • Greg_Deckler's avatar
    Greg_Deckler
    Icon for Community Champion rankCommunity Champion

    Anonymous Try:

    RejectedLine = IF(TableName[TextField]="" ||
                    SEARCH("]",TableName[TextField],,0)=LEN(TableName[TextField]) ||
                    CONTAINSSTRING(TableName[TextField],"deleted or reassigned"),
                    "No","Yes")