Get the index of a particular value in a data table

How can I get the index of a particular value on a certain column? Column name “Status”

1 Like

With expression like this
Int_columnindex = Yourdatatablename.Column.Indexof(“yourcolumnname”)
Where int_columnindex is a int32 variable

Cheers @rohangroombridge

Hi, Thank you for looking into this. May I ask how your syntax get a particular value from that column?


How do I get the index of Row3…?


  1. use Read Range activity to read the data from excel file and will give you output as DataTable and say ‘DT’.

  2. And then use ForEach Row activity to iterate that DataTable.

    ForEach row in DT
        Int index = DT.Rows.IndexOf(row)+2
        If row("Status").Tostring.Equals("requiredValue")
       Then print index value.

In that case
Use a for each row loop and pass the datatable variable as input
—inside the loop use a writeline with this expression

This will give us the row index
While the previous comment mentioned expression will give us the column index

Cheers @rohangroombridge

Thank you. What if I need to start at a particular row?

Example workflow:
Read range excel spreadsheet (output = DT)
The DT Will look like this:
Column name: “Status”
Row1 = “Completed”
Row2 = “Completed”
Row3 = “Completed”
Row4 = “Completed”
Row5 = “In Completed”
Row6 = “In Completed”
Row7 = “In Completed”
Row8 = “In Completed”

I need to have the for loop dynamically start from the for row with a value of “In Completed”. The “In Completed” value index’s will change everytime new data is loaded into the spreadsheet so I need a way for the for loop to start looping at the first row of the index of the row containing the “In Completed” value

How do I do that?

if you want to process only “In Completed” records, use if condition --> row(“status”)=“In Completed”

Then proceed.


use Filter datatable activity to filter “In Completed” records alone then loop through.


Thank you for replying. Just to clarify to everyone. Every loop I am doing I want to replace the cell value from “In Completed” to completed. I’m not sure a filter activity will do this because won’t it filter what I need and then I don’t think it will write to the same cell index back into my spreadsheet will it?