Formula Not Working in For Each when Row numbers are random


I have a Filtered Data in Excel with which I have to do a summation of two columns.
I used a Write Cell activity inside For Each Excel Row activity to do the summation row by row. I passed the row index using either CurrentRow or Current Index, but neither of them worked. The Row no in excel is random first row is 183 and the second row is 505 due to filtered data. I believe it is because of this random row my currentrow or currentindex is not working.

Kindly help to resolve it.

Index value always starts with 0 so we need to add 2 to those values so that bot will fill in that correct cells in excel

For example if you are getting index like this

CurrentIndex = (dt.Rows.IndexOf(CurrentRow) + 2).ToString

Where currentIndex is a string variable and CurrentRow is a variable name of for each row activity

Cheers @Karthikeyan_Lohanathan

Hi @Palaniyappan

Please see the below Screenshot.

Hi @Palaniyappan

I got the issue sorted. I replaced the For Each Excel Row with For Each Row in Data Table.

Thanks a lot for your solution.

HI @Palaniyappan

It worked only for the first two rows as it has the count within the data table row count. that is the dt row count is 695. the first random row no is 183 and the second row is 505. So in the For Each Row In Data Table activity when the current index is 183 & 505 it updates those two rows alone. Except those two rows all the remaining rows are blank. Please see below SS.

I need to apply the summation for the remaining rows as well. How to do it?. Kindly help.


Is there any blank rows in between these rows



No Blank Rows.


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