Seperate Sum of Each Row of Two Column


I have an excel table as below. I have a cycle and in this cycle I get random column from this table. And I want to sum each rows of columns and at the end obtain total number of reference 1, 73 etc. Bu I couldn’t find how to add rows of two columns seperately.


Hi @AnnaDewitt

Did u need the sum of columns values ?

Also what u mean total number of reference

For instance It will sum first rows of X1 and X3 and keep it first row of new data table, then do same thing for second row.

Hi for this do like this way:

  1. Read the excel file and store in dt1
  2. use for each row to loop through each row,
    inside the for each row do the following
    assign sum = cint(row(“X1”))+cint(row(“X3”))
    write the sum to the specified cell by using write cell activity
1 Like

find some starter help here:
AddCol_RandomColsRowSum.xaml (7.9 KB)

you can by random assign the cols to sum up to the variable: SumCols and it is creating the report DataTable. It is dynamic and will sum up all columns found in the SumCols string Array

Thank you! But in this way, it writes same row always.

Thank you! I will check it.

hi @AnnaDewitt u need to make the write cell dyanmic, in the for each row there is index property which stores the index of row through which we are iterating , let say we put a variable index there
using that we can write to a particular cell in dynamic.
lets say the sum column is under the G column , then in write cell activity in cell section u can write , “G”+ (index+2).ToString