Search code examples
libreofficelibreoffice-calc

How to filter rows based on specific values in Libreoffice?


I have a table with several columns.

enter image description here

I want only the lines where target value is different from alg value. In this case where target is 1 and alg is 0. So, line 2, 4 and 5 should stay and line 3 should be removed. How to do that?


Solution

  • Add a column that determines whether the row should be removed. The formula for D2 is =B2=C2, and this is filled down to D5.

    id      target  alg     remove row  string
    11011   1       0       FALSE       hello
    111     1       1       TRUE        this is
    111     1       0       FALSE       car
    112     1       0       FALSE       ship
    

    To hide the rows, go to Data -> More Filters -> Standard Filter. Set criteria to remove row = FALSE. If desired, column D can be hidden by right-clicking on D and choosing Hide Columns.

    Alternatively, to completely remove the rows, sort by column D and then select and delete all rows where column D is TRUE. Finally, delete column D.

    Related: LibreOffice / OpenOffice Calc: Remove rows where value is *not* in column on other sheet