How do I read and compare a cell above the current cell I am looking at?

Hello,

I want to use UiPath to insert row in between these rows.

The logic I was going to use was:
Read range → if value in cell D3 -1 =/= value in D3 → then insert three rows into sheet.

There are features in alteryx that would be able to do something like this. Not sure if there is something similar in UiPath. Any help is apperciated.

Below is an example of the sheet I am working with. I want to insert rows where the highlights are.

image

Thanks

Hi @Chris_Peake_US

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.

Best regards
Roman

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