Can't perform the sum of the column in excel, it derives a 0 value

Hello team,

Since I am new in this journey, I need your support to find a solution for my workflow.
I have a CSV file, from where I read the data in a datatable, which results in 96 rows divided in 3 columns (Date,Value1,Value2). After reading, I have to make the sum of values in columnB (SUM1), the sum of values in columnC (SUM2), and then the sum Total = SUM1 + SUM2
After that I have to copy this sum values and append to an excel file, which is updated day by day with the new info. The structure of all this activites should be outputed in a format as shown in the attached Output.xlsx file. When I execute it, the excel file generated by reading the csv, can’t perform the sum of the columns, it derives a 0 value.
image
image
image
image

Waiting for a feedback from your side to help me make it work!

Thank you in advance!
Output.xlsx (8.7 KB)

Hi again,

Uploading also the printscreen of the excel table.

image

Hey xhulia, could you upload an example input file please? I believe it’s the file that we sum the lines.

Thanks!

Please watch this video to learn more about writing a formula like sum in Excel.

Video: UiPath | Write Formula in Excel | How to write formula in excel with UiPath | Excel Automation - YouTube

Best regards
Mahmoud

Hi, instead of using excel functions, you can first create an integer type variable callled ‘sum’ and assign its initial value to ‘0’ (zero). Then read your excel as a datatable and iterate through it with For Each Row activity. Inside the for each activity, you can access the cell, with the following row.Item(“columnName”) or row.Item(columnIndex) and add to ‘sum’ variable.

Before you add the values, please don’t forget to convert the row value to integer because when you read from excel file the value is considered as string variable. Then you can write that ‘sum’ variable to the file.

Hope it helps !

Hi @Dawodm,

Thanks for sharing the video, but it can’t be the solution in my case, because I need the sum of the whole column (the sum of 96 rows). The formula can’t be inserted as “=B2+B3+…B96”. That’s why I have put it "=SUM(B2:B97), but it derives in “0”.

Thanks anyway! :slight_smile:

Thanks @selinsecmen

Solved!

1 Like

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