Forum Discussion

InsightSeeker's avatar
InsightSeeker
Helper III
1 year ago
Solved

Creating a Conditional Column Based on Specific Criteria

Hello,   I need help creating a new column based on the following conditions:   - If the **Settle_Name** is equal to "Card" or "OCCF", and - The **Code** is equal to "000100160", and - The **Nu...
  • Anonymous's avatar
    Anonymous
    1 year ago

    Thanks for the reply from rsbin.

    Hi InsightSeeker ,


     I have made some modifications to rsbin's formula and get the expected results for the data you have given.

     

    Since there are two "code" columns in the data you gave, use "code.1" instead for the second one:

     

     

    Status =
    SWITCH (
        TRUE (),
        ( [Code] = "000100160"|| [Code] = "000100234" )
            && ( [Settle_Name] = "Card"|| [Settle_Name] = "OCCF" )
            && LEN ( [Number] ) = 11
            && LEFT ( [Number], 4 ) = "4398"
            && RIGHT ( [Number], 4 ) = "1614"
            && NOT ( ISBLANK ( [Code.1] ) ), "Valid",
        "Error"
    )

     

     

     

    Here is the same result as you show in the given table:

     

    Best Regards,
    Zhu
    Community Support Team

     

    If there is any post helps, then please consider Accept it as the solution  to help the other members find it more quickly.
    If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!