How to multiply an excel column by -1?

Hi,
I have an excel column consisting with doubles. I want to multiply column A by -1.
image

and I want my output to be as follows

image

Thank you.

Hi @makboga

You can use the following LinQ query in the Invoke Code activity:

yourDt.AsEnumerable.ToList.ForEach(Sub(row)
row("Tutar (UPB3)") = (CDbl(row("Tutar (UPB3)").ToString) * -1).ToString
End Sub)

Hope this helps,
Best Regards.

Thank you for solution but I am getting this error

Hi @makboga

You can only convert a string to double if you are sure that the string contains only numeric values & not any text characters. Before converting the data to double, please make sure it is compatible with the double conversion.

Best Regards.

Hi @makboga ,

Try this:

DT1.AsEnumerable.ToList.ForEach(Sub(row) row(0)= if(Information.IsNumeric(row(0)),CDbl(row(0))*(-1),0))

Use this in Invoke Code activity with DT1 as in/out argument.

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.