dvn
(Dubhan Conry)
February 10, 2020, 6:03am
1
I have a list of purchases made for the week on an excel sheet with the amount of money spent on each line.
How can I assign to a variable, the total sum of column “F”.
I tried
TotalPrice = 0
For each row: TotalPrice = TotalPrice + Convert.ToInt32(row.Item(5).ToString.Replace(“,”,“”))
But kept getting 0 as the output.
Please help!
@dvn Try using Convert.ToDouble
gulab
(Gulab Kazi)
February 10, 2020, 6:10am
3
Hi @dvn
Can you attach workflow or screenshot?
dvn
(Dubhan Conry)
February 10, 2020, 6:13am
4
Here it is with the full information at the bottom
TotalPrice = 0
For each row: TotalPrice = TotalPrice + Convert.ToInt32(row.Item(5).ToString.Replace(“,”,“”))
When I try to input the new TotalPrice somwhere else, I would expect the some of all the spendings but instead I get 0
samir
(Samir Mohite)
February 10, 2020, 6:39am
5
Hi @dvn ,
for this you use following code in Assign activity after the read range activity.
SumCol = (DT.AsEnumerable().Sum(Function(r) Convert.ToDouble(r(5).ToString.Replace(",",""))))
DT —> Output var of Read Range.
SumCol —> Should be of type System.Double
You can use MessageBox with variable SumCol to check the value.