Hi, read 2 Value A and Value B from excel, will want to perform a calculation of Value A divided by Value B -1 into a new added column “Col C”. How can do this?
Hi @jerry.kohzl
welcome to forum
to do this please check the below steps
-
Read the excel file and store in datatable variable dt1
-
Now use for each row to loop through each row of dt1
inside the for each row use the following assign activity
row(“Col C”)= CInt(row(“Value A”))/CInt(row("Value B-1))
Then outside the for each row, use write range to write the updated datatable to excel file
[note, i am assuming that Value A, Value B are the name of columns of excel file]
Mark it as solution if it resolves ur query
Regards,
Nived N
Happy Automation
Possible to use float? Is this valid? Also how can i write this value as percentage to excel?
Double(Double(row(“Value A”))/Double(row(“Value B”))-1)
Yes it is possible
instead of CInt use CDbl
Regards,
Nived N
Happy Automation
Encounter this error. Can help?
Double(Double(row(“Value A”))/Double(row(“Value B”))-1)
Assign: Exception has been thrown by the target of an invocation.
Hi @jerry.kohzl
Use like this
row(“Col C”)= CDbl(row(“Value A”))/(CDbl(row(“Value B”))-1)
Regards
Nived N
Happy Automation
Thanks Nived. It works.
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.