# Excel Row Iterations

Hi

I am trying to perform calculations on cells in excel rows and I need to do this in a loop -
E.g.
Col1 Col 2 Col3
3 2 5
5 6 8

I need the result to be (3-2)*5 and (5-6)*8. There are other columns in excel too.
Is there a way to automate this calculation using loops. I can do it for one row using expression. But unable to work with multiple list variables here.

Thanks
Varsha

Varsha, I think something like this should work in your case.

Will try this approach.

1 Like

I tried it but unable to successfully done, getting step 4 error

@mateenkk What error do you get? can you post your script here?

Thanks @ashapkina and i have sucessfully implement that task you can watch this video

Again Thanks

1 Like

hey @ashapkina i have too got the same error on performing the above script provided by you
nd error is :-

@ddivya can you share the screenshot of the For Each and Expression actions, or share your script?

actually i have excel sheet in which columns
col13 col14 col15 col16 col17 col18
80% 45% 50% 60% 70% 80%
i have to find the average nd put into cell A15 = (col13++col14+col15+col16+col17+col18 )/6 .

@ddivya in each column (items), you only have 1 element, so \${item[3]}. \${item[4]}, etc. don’t exist.

In this case, the most efficient way is to open the Excel file and calculate the average using Excel function.

excel-average.zip (28.7 KB)

thnx @ashapkina

thnx @ashapkina above solution is working bt if i want to do it through below script then how to do it

As you only save 1 row from Excel, you need to save it to a List variable and then convert to a Number

calculate the sum

and divide by the total number of cells, then convert the result back to String and paste into Excel

excel-iteration.zip (7.2 KB)

thnx @ashapkina bt it’ shows some error

It is caused by this bug

thnx @ashapkina it’s solved

1 Like