How to add two column of the data table and paste it into third column

Hi All,

I have a datatable variable dt in which I have datatable extracted from a excel.

In that datatable I need to add the values of two column together and paste it into the third.

Column A , Column B values added and a new column C is added to the same datatble and sum of column values of A and B pasted there i.e in column C

Please help.

1 Like

what’s the value on Column A and Column B??
is it Maths related or Just text?

the value is math related. They are numbers
987989 ,9878.09 ,8678.98

Since this is extracted from Excel, This can be handled in the same itself.

write Cell with the Formula of Add Column A and B .
Then Auto fill range for the rest of the cell in the column.

Hi @Karan28

I have created workflow based on your requirement please unzip and run check Test.xlsx file.
Here I took input for ColumnA,ColumnB and I added those two columns into ColumnC.
I hope you will get solution (20.1 KB)

Kommi Jeevan.

1 Like

Cheers @Karan28 if you find it useful mark it as solution and close the thread.

Hi thanks for the solution but I am getting this error

Get Row Item: StringConverter cannot convert from System.Double.

I am getting the same error but for a different post.

@Karan28 - I think it has something to do with being a string variable when it should be an integer variable.

if you have a datatable called dt_ExcelData, with columns: Name, Salary & Bonus and you need a new column called Total Salary (Salary + Bonus)

  1. Use Add new Column activity “Total Salary” - at the required place in your workflow
  2. Add an assign activity
    Put this in the left-hand side of the assign dt_ExcelData.Columns(“Total Salary”).Expression
    Put this in the right hand side “Income+Bonus”

After this point you should now have the calculated value for all rows in the table without using a loop.

The calculated column “Total Salary” is changing after writing it into excel :frowning:

another problem I am having is that the two columns Income and Bonus in my case these columns have space like “Income Value” and “Bonus Value” so how to manage when the column names are having spaces :frowning:

please explain by screenshot based.

The example is available in the Uipath docs.

I have used same file from example and added write cell to it.

  1. write in the 1st cell with the required formula .
  2. Auto fill range from written cell till the end of the range.

Thankyou , It was very helpful.

1 Like

here we go!! one more doubt in excel activity
I need to do a calculation in 4 consecutive cells in a column.
by writing to each cell is a time consuming activity
Is there any other way???

Doest work