How to get the column index of a particular keyword

I have one keyword based on that i want to extract the column index of that particular keyword.

please help

Can you elaborate your question? What is the relationship between your keyword and column name/index?

I want to just fetch the column index where these keyword present

1 Like

Hey @Doonline

The below will fetch you the column index of the matched keyword from the datatable.

dt_master.AsEnumerable.Where(Function(row) row.ItemArray.Contains("keyword")).First().ItemArray.IndexOf("keyword")

The above statement has,

  1. It will first identify the row in which the keyword is present

  2. Then It will identify the column index from that row which has the keyword

Hope this helps


1 Like

Hi @Doonline ,

There are many methods in which we can get the Column Index of a Particular Keyword from a Datatable.

Although it may not be certain of the Keyword uniqueness, the below workflow will retrieve the Column Index of the Keyword of it’s First Match while searching the rows.

Check the below workflow having an Example and Let us know if it doesn’t work or need an alternate solution.
Get_ColumnIndex_OnKeyword.xaml (9.3 KB)

we would recommend to have a more specific requirements also handling e.g.

  • value can be found on different rows or not
  • value can be found on different columns or not

Have a look on following flow, generating a report on the different occurrences:

find starter help here:
GetAllRowColIdx_By1Value.xaml (10.7 KB)