How to subtract two columns which has double datatype values

two columns has double data type values how to subtract them and add a new column beside of that and enter the values in that column

Hi @anjani_priya

Read Range (Output: dt)
 For Each Row (Input: dt)
   Assign: row("Result") = CDbl(row("Column1")) - CDbl(row("Column2"))
Write Range (Input: dt)

Hope it helps!!


Can you try as the following?

dt.Columns("sub").Expression = "Convert([Column1],System.Double)-Convert([Column2],System.Double)"

Please modify column name for your datatable.


Should I " " in the right side of assign?

Yes, as the above screenshot.

getting this error

Can you share screenshot of your expression?

Can you share the sample input excel

Book1.xlsx (8.8 KB)
this is the sample
at c column the subtraction should reflect


Can you check the following sample?

Sample (9.2 KB)




- Read Range (Input: Excel File, Output: DataTable)
- Add Data Column (Name: Result)
- For Each Row (Input: DataTable)
    - Assign (Left: row("Result"), Right: CDbl(row("Amount(in RS)")) - CDbl(row("Closing Debit")))
- Write Range (Input: Modified DataTable, Output: Excel File)

Hope it helps!!

@anjani_priya (201.1 KB)
Found Solution in sequence3.xaml

error got

Did you run the sample as it is?

If not, there might be invalid double data in your datatable.


Book1.xlsx (10.3 KB)
check you once check for this sheet?

Try by updating the package or by Restarting your system

i have changed the data once check