Can I apply filter to 2 columns in excel?

Hi All,

I have a use case where I have to apply filters on 2 columns in excel. In the 1st column I need to filter values containing “-” and in the 2nd column I need to filter non-empty values. I have been trying to do this by using excel modern filter activity, using 2 of them one after the other, but the issue is that the filter activity somehow clears filter from other columns before applying filter on a particular column. Hence, I am not able to apply filter simultaneously on the 2 columns. Can somebody please help on this?

Hi @Shobhit_Jain_IN

Can you try this

Filter1:

Filter2:

Input:

Output:

Regards,

@Shobhit_Jain_IN

Welcome to Community!!

you can filter Data table activity where you can filter your data table after reading the excel file. You can add multiple columns how many you want..

1.Read Range Workbook Activity to read your excel file. create output variable
2.Use Filter data table activity in input Pass above output variable and in Output variable you can create Data table variable.

in above screenshot you can click + icon you can add more conditions with your columns.

Follow below tutorials

Hi @Shobhit_Jain_IN

Welcome to UiPath,

Pls add a Filter Table activity, Select the table and set two filter conditions.
then Set Column1 to contains “-” and Column2 to is not empty.

If you found helpful, Mark as a solution tick .
Happy Automation

You can use linq for this for exact results.

filteredDT = yourDataTable.AsEnumerable().
Where(Function(row) row(“ColumnA”).ToString.Contains(“-”) AndAlso Not String.IsNullOrWhiteSpace(row(“ColumnB”).ToString)).CopyToDataTable()

Mark solution if its help happy Automation :blush: