# I want to create an algorithm to fix rows with errors

**URL:** <https://forum.uipath.com/t/topic/5788496>\
**Category:** フォーラム\
**Created:** [November 6, 2026, 8:31am UTC](https://forum.uipath.com/t/topic/5788496 "2026-11-06T08:31:37Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![gorby](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/gorby/32/543563_2.png) [@gorby](https://forum.uipath.com/u/gorby)\
**Post date:** [November 6, 2026, 8:31am UTC](https://forum.uipath.com/t/topic/5788496/1 "2026-11-06T08:31:37Z")

</div>

Hello.

I am a UiPath StudioX Enterprise Licence 2024.10.14 LTS user.

1. Assumptions

I have a list variable lis\_RowNo = {20,40,50} that stores the row numbers of blank rows in Excel.  
After deleting the blank rows in Excel, I process the rows from top to bottom and store the row number where an error occurred in the Int32 variable int\_ErrNo.

Since blank rows were initially present in Excel, the error row number stored in the Int32 variable int\_ErrNo after deleting the blank rows is 30, but when considered against the original Excel sheet, the correct value is int\_ErrNo = 29.

1. What I want to do

Would it be possible to create an algorithm that uses the list variable lis\_RowNo = {20,40,50} to correct the error row number in the Int32 variable int\_ErrNo?

---

<div class="post-metadata">

**Author:** ![arjun.shiroya](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/arjun.shiroya/32/545217_2.png) [@arjun.shiroya](https://forum.uipath.com/u/arjun.shiroya)\
**Post date:** [November 6, 2026, 8:37am UTC](https://forum.uipath.com/t/topic/5788496/2 "2026-11-06T08:37:20Z")

</div>

Hi @gorby ,

Yes. Assuming lis\_RowNo contains the blank-row numbers from the original sheet and int\_ErrNo is the original row number, use an Assign activity:

```auto
correctedRow = int_ErrNo - lis_RowNo.Count(Function(r) r < int_ErrNo)

```

> For `int_ErrNo = 30` and `lis_RowNo = {20, 40, 50}`, only row 20 is before row 30, so the result is `30 - 1 = 29`. Use `<` because only blank rows before the error row should be counted.

---

<div class="post-metadata">

**Author:** ![gorby](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/gorby/32/543563_2.png) [@gorby](https://forum.uipath.com/u/gorby)\
**Post date:** [November 9, 2026, 4:44am UTC](https://forum.uipath.com/t/topic/5788496/3 "2026-11-09T04:44:55Z")

</div>

> [@arjun.shiroya](#):
>
> `correctedRow = int_ErrNo - lis_RowNo.Count(Function(r) r < int_ErrNo)`

The correct version was

`correctedRow = int_ErrNo + lis_RowNo.Where(Function(r) r <= int_ErrNo).Count()`

You almost got it!

May Genesha bless you.
