Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
7 years ago
Solved

Filter a table with multiple conditions

Hi all, 

 

I have a table such as :

 

And I'd need a column that filters with specific criteria : 

- If it's A or B, lenght has to be min 5

- If it's D, lenght has to be min 4

- If it's C, lenght has to be min 2 

I tried a multiple IF, such as : 

Filtre = if(Table[Class]= "A" || Table[Class]= "B" && Table[Lenght]>5 , 1 ,
if(Table[Class]= "C" && Table[Lenght]>1 , 1 ,
if(Table[Class]= "D" && Table[Lenght]>3 , 1 , ,0)))

 

It doesnt retrieve error, but it doesn't filter correctly. Any ideas? 

Thanks in advance!  

 

Ana 

 

  • Anonymous  Please try this as a "New Column"

     

    Filter = IF(Test280MultiIf[Class] IN {"A","B"} && Test280MultiIf[Length]>=5,1,IF(Test280MultiIf[Class]="C" && Test280MultiIf[Length]>=2,1,IF(Test280MultiIf[Class]="D" && Test280MultiIf[Length]>=4,1,0)))

4 Replies

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

    Anonymous  Could you please confirm the below logic. That means, all the classes should be minimum of length 5. Is that you are looking for ?

     

    - If it's A or B, lenght has to be min 5

    - If it's D, lenght has to be min 5

    - If it's C, lenght has to be min 5 

    • Anonymous's avatar
      Anonymous
      Not applicable

      sorry, no, my mistake. A & B <5 ; C < 2 and D < 4, i corrected the main question

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

        Anonymous  Please try this as a "New Column"

         

        Filter = IF(Test280MultiIf[Class] IN {"A","B"} && Test280MultiIf[Length]>=5,1,IF(Test280MultiIf[Class]="C" && Test280MultiIf[Length]>=2,1,IF(Test280MultiIf[Class]="D" && Test280MultiIf[Length]>=4,1,0)))