If condition in Excel-document: how to get index of row to Write into specific Cell


Currently, i have a workflow that reads a Excel-document via Read Range, after that i use Output Data Table for it to be used inside the IF activity with Condition, Data Table from Output Data Table activity, to check if my data table contains “variable”.

I am trying to write into the specific row that contains the match from the IF condition.
Correct me if i am wrong, but i need to get the index of that row.

Is this possible without the for each row? or is this necessary to contain index.
As for now, inside the IF i can’t use: datatable.Rows.IndexOf(row) because the data table used inside IF is a string. Retrieved from the Output Data Table ‘text’.

Thanks in advance!


If i understand your requirement correctly, the following will work.

 dtAdd = dt.AsEnumerable.Select(Function(r) dtAdd.Clone.LoadDataRow({if(r(0).ToString.Contains(KVK),"found","not found")},False)).CopyToDataTable

The above make additional datatable which has result of check if each row contains keyword. Then write it to worksheet using WriteRange.


1 Like

Use “Lookup Range” Activity to get the Index for a particular row.

1 Like

Appreciate the help! The LookUp Range was very easy to apply. Thanks to both!

How could the Value from LookUp range be used as a condition with Write Cell activity?

Hi @sirwa,

Using lookup range you would get a cell number for eg: “E11” and you need to write to cell say “H11”, you just have to separate the number and the alphabet.
To separate number and the alphabet use regex expression.

1 Like

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