Counting number of lines between static rows


I have an Excel document and I hope to count the number of lines between every row that starts with “ID” (string). I have used “Read CSV” activity and then I’m not sure what activity to use.

I’m sure I’ll have to use the count function though (but not very sure of the syntax): datatable.Rows.Where(IndexStart=“ID”).Count

Please advise. Thank you!

If you want to get count of rows which have “ID”, you can use"[ColumnName] like ‘%ID%’]").count

1 Like

Sorry I don’t want to count the number of rows with cells with “ID”. I want to count/know the number of rows between cells with “ID”. Thanks

Please see the attached project. I have used For each row with if conditions. (10.1 KB)

Thank you! It works! Now I can continue my project to figure out how to print that count number into a column in the excel sheet. Thanks for your help :slight_smile:

1 Like

Your welcome. If it is the rite solution, please mark it as solution

To write in excel, you can use write cell and provide the cell address with counter. Like “D” + counter.tostring