Returning Index of Last Row that Equals a Certain Value

Title is a little long

image

I need to return the row index of the last row that says “Yes” for instance in the picture it would be the row index of filedITU

Hi @rmorgan ,

Could you maybe try with the below Expression :

rowIndex = DT.Rows.IndexOf(DT.AsEnumerable.Where(Function(x)x("Value").ToString.ToLower.equals("yes")).Last)

Here, rowIndex is of the type Integer and DT is your Datatable variable, assuming Excel sheet is already being read into Datatable

Let us know if this does not work.

2 Likes

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