Forum Discussion

Saxon10's avatar
Saxon10
Post Prodigy
4 years ago
Solved

Switch multiple condition for multiple columns

  I have 5 columns are A,B,C,D and type. Those 5 columns are contain number and text or number or text. If column A&B and C&D are matched then return "Ok" and if column A&B and C&D are not matched ...
  • jdbuchanan71's avatar
    4 years ago

    Saxon10 Give this a try

     

    Result2 = 
    VAR AB = [A] & [B]
    VAR CD = [C] & [D]
    RETURN
    SWITCH (
        TRUE(),
        AB = CD, "OK",
        [TYPE] = "TT","XX",
        [TYPE] = "AA","X1",
        [TYPE] = "BB","X2",
        [TYPE] = "PR","X3",
        (ISBLANK ( AB ) || AB = "" ) && ( ISBLANK ( CD ) || CD = "" ), BLANK (),
        (ISBLANK ( AB ) || AB = "" ) || ( ISBLANK ( CD ) || CD = "" ), "A1",
        "NO"
        )

     

    All my results match your deisred result column.