Difference between two columns

Hello,

I’m trying to calculate the difference between two colums, A B, and put the difference (row by row) into a column C.

had anybody idea about a good approach?

Hi @abdel,

For each row activity
Inside use
Assign activity
row("c")=Convert.ToInt32(row("a").ToString())-Convert.ToInt32(row("b").ToString())

Regards, Arivu :slight_smile:

2 Likes

@abdel check attached file

ExcelSum.zip (7.8 KB)

i saw your code but what if i had values like “34.35” “1.5”

@abdel Inside the assign activity give convert to double and change sum variable type to double

Convert.ToDouble( row(“column 1”).ToString) +Convert.ToDouble( row(“column 2”).ToString)

thanks you how to get the name of headers of the excel

@indra: in your code: Assign : Input string was not in a correct format.

@abdel check attached file
ExcelSum.zip (7.8 KB)

Thanks: i’m using row(3) = Convert.ToDouble( row(“Colomn 0”).ToString) -Convert.ToDouble( row(“Column 1”).ToString)
inside a Foreach but it does not write inside the excel file!

Can you attach your workflow

it did not work

@abdel u want do that operation in excel?

yes, i used row(3) = Convert.ToDouble( row(“Colomn 0”).ToString) -Convert.ToDouble( row(“Column 1”).ToString)

@abdel find below workflow. it will be useful without headers.

Addition.xaml (7.0 KB)

If excel sheet has headers. Try below code

Addition.xaml (7.1 KB)

Let me know if it works for u or not

i have two columns like current DateDifF.xlsx (8.5 KB)
System Date and value date i want its diffrence in other column No. Of Days

@suraj23 you want total number of days between 2 dates right?

ya right

can u provide me solution for different date format.have sent u my excel sheet above DateDifF

@suraj23 Check the workflow below.

DateDiff.xaml (11.3 KB)