Counting number of lines between static rows


#1

Hello

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!


#2

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


#3

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


#4

Please see the attached project. I have used For each row with if conditions.

BlankProcess1.zip (10.1 KB)


#5

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:


#6

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


#7

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


#8