Difference between two columns

studio

#1

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?


#2

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:


#3

@abdel check attached file

ExcelSum.zip (7.8 KB)


#4

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


#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)


#6

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


#7

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


#8

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


#9

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!


#10

Can you attach your workflow


#11

it did not work


#12

@abdel u want do that operation in excel?


#13

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


#14

@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


#15

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


#16

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


#17

ya right


#18

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


#19

@suraj23 Check the workflow below.

DateDiff.xaml (11.3 KB)