How to match words to excel columns table and rank number the match according to the number matched

Sample data.xlsx (11.8 KB)
Hi I am a super newbie to programming in UiPath.
We are students trying to do counting on specific words on a data table. Based on the matched word count from each column. Based on the count, rank the columns according to the counts of matched words. Please see the attached file for same data input and desired output…

Hi @Benson1

Using the following query in the Invoke code, you shall be able to get the count of the work ‘Car’ & ‘Red’, as per this use case:

row("Car") = System.Text.RegularExpressions.Regex.Matches(row("Sentence description").ToString.ToLower, "\bcar\b").Count
row("red") = System.Text.RegularExpressions.Regex.Matches(row("Sentence description").ToString.ToLower, "\bred\b").Count
End Sub)

The output looks like this:

And the arguments that you should send inside the Invoke Code panel:

Once you finish the count extraction, you can proceed with the ‘Ranking’ mechanism as per your requirements.

Hope this helps,
Best Regards.

1 Like


use for each row in datatable

inside use regex expression to find the cars and red in each row


pass the value in the columns of the car and red

to get total values of red and car in to the column



1 Like


if you face any issues let me know


Thanks for the suggestion…

1 Like

Thank you for your help. However, as we are very new to these… i am facing some variable declaration errors… anyway to guide us? Thank you :slight_smile:

Thanks Shiva. But we are stuck with the following issues… as indicated in our previous post.


Can you check the values of redcount and carcount which you have passed in the invoke code