One solution using various activities would be:
If you use the “Read Cell” Activity, you can compare the first value with the previous value (store the first Read Cell Activity i.e. as str_Cell1; and the second one as str_Cell2). Which Cell should be read? Use:
“D”+int_RowIndex.ToString
or “D”+(int_RowIndex-1).ToString
You could compare the two values in an If-Activity (If str_Cell1 = str_Cell2 → Do Nothing, Else → Insert your desired Rows.
However, how do you keep track and loop through all the rows? First of all, read the whole range (Read Range) and loop through the datatable (For Each Row). Moreover, you’d need to initialise your int_RowIndex and increment this in each run (+1), but also add +3 if you insert the rows in the respective scenario.