Need to bifurcate the month

Total Amount -160.57

Need code for rhe calculation part in I column
The calculation part of I4.
Is Total Amount given above -value in H4
ie). 160.57-6.41 = 154.16

Then calculation part for I 5 Column is
Value in I4-value in H5
ie) 154.16-6.41=147.75

Like I 5 Column calculation we need to do for remaining column.
For example:
Then calculation part for I 6 Column is
Value in I5-value in H6
ie) 146.75-6.41=141.34

same for remaining column I6-I20

Note: calculation should be done by bot should not used excel

Hi @sruthesanju ,

Read the file , then use the for each row , inside the loop assign value to the variable as (Column4-column3 ) , write it down in next column

Can you please send code with the output i have mentioned column I

Please share the data set

Hi @sruthesanju

Can you share the input data and required output.

Regards

The above excel image F-H column I will get as input
Another input value is total amount -160.57.I need to calculate I column

Please share smple input data in excel file

bifurcate.xlsx (6.8 KB)

So I first column alone calculation part will be in column D2:Total Amount -value in column C2=160.57-6.41=154.16

For Remaining column
Value in columnD2-Value in column C3
154.16-6.41=147.75

Note: total amount value: 160.57 which I will get as input

Hi @sruthesanju ,

read the value from C2 with read cell then do operation and write it in D2
then try to use read range activity and use range from A3, then use for reach row activity , inside the loop assign do the operation for every row value and update it at the same time

It should not be done in Excel I will get it as data table

Can we have a connect tomorrow if you need explanation.

Use write cell inside the loop , so that u can wite the result at same time back into the excel file

No need to do in Excel I will get as datatable.i need to do that calculation using code not using cell value.For your reference I have given in Excel

Hi @sruthesanju

resultDataTable= yourDataTable.Clone() ' Create a new DataTable with the same structure as 

' Add a new column "D" to store the subtraction results
resultDataTable.Columns.Add("D", GetType(Double))

' Perform the subtraction operation and populate the "D" column in the resultDataTable
For Each row As DataRow In yourDataTable.Rows
    Dim newValue As Double =160.57 - CDbl(row("Value"))
    resultDataTable.Rows.Add(row.ItemArray.Append(newValue).ToArray())
Next

invoked Arguments


resultDataTable will have the subtracted value in D column. You can change the column name as per your convenience.

Regards