How do I get the index of the cell which holds the same value in the previous rows?

Hi,
one possibility would be to add an extra column to your datatable.
Then you can use a loop to fill that new field with an incremented number (in your example 1-7) and use that field as index for the Remarks text.