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!!

HI,

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.

Regards,

Should I " " in the right side of assign?

Yes, as the above screenshot.


getting this error

Can you share screenshot of your expression?

@anjani_priya
Can you share the sample input excel

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

HI,

Can you check the following sample?

Sample
Sample20231207-1aL.zip (9.2 KB)

Regards,


error

@anjani_priya

- 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
BlankProcess4.zip (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.

Regards,

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

@anjani_priya
Try by updating the package or by Restarting your system

i have changed the data once check