How to filter the column if cell contains specific keyword?

Hello, all

I’d like to get some helps for sorting data if it contains specific words.
Example, if column ‘Name’ contains ‘joy’ keyword, I’d like to extract row which has ‘joy’ keyword.
[excel]

[Filter]

[Result]

Thank you !

Hello @Dorothy_lee ,

You can use filter Data Table activity, For filtering the data.

In Filter data table activity

Column Operation Value


row(“Name”).Tostring.Trim Contains “Joy”

Then you can use a write range activity to write the data in an excel sheet.

Thanks & regards,
Om Prasad

1 Like

Hi @Dorothy_lee

You can set it as follows: Add the following activities:
Read Range Activity to read the Excel File and save the data in DataTable variable
For Each Row Activity for the DataTable variable
If Activity → Condition is: row(“Name”).ToString = “joy”

Best regards
Mahmoud

1 Like

Hi @Dorothy_lee

You can use linq query to achieve your requirement.

(from x as DataRow in dtInptut where x("Name").ToString.Contains("joy") select x ).CopyToDataTable

2 Likes

Hi Dawodm
if use like this i hope you are not get the out put because bot will search only joy so if the row (name ) = joy means it will search only joy not joydema she is asking joy or joydema she want to filter those things so use like this row(“name”).Contains(“joy”)
I hope you understood what am try to say

Thanks
Chethan P

2 Likes

Hi @copy_writes

Ah ok thanks for the feedback. I didn’t see it. I though she searches for joy.
row(“name”).Contains(“joy”) Works if it is no matter where is the joy keyword.

But @Dorothy_lee if you search for only joy at the beginning you have to set it so:
row(“Name”).ToString.Substring(0,3) = “joy” → Here you check only the first three characters.

Best regards
Mahmoud

2 Likes

@ranjith Thank you for your helps !
It’s resolved with your script.

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.