How to change negative value of particular column values

Hi Team,

I want to change all the value to negative for particular column.

Please help me anyone for this.

Input:
image

Expected Output:
image

Regards,
Raja G

when only multiply it by * -1 we would risk a toggling. For a reliable setting to minus we can do:

Math.Abs(CDbl(yourColValue)) * -1
1 Like

Hi @Raja.G

dt.AsEnumerable().ToList().ForEach(Sub(row) row("Amount") = -Math.Abs(CDbl(row("Amount"))))

Input:

image

Output:

image

Regards,

1 Like

Simply eay could be:

1st
[Read Range].

2nd
Check DataTable-Vlaues with [For Each Row in DT]

3rd
if Value.toString.contains(“-”)
== True → Nothin todo
== Fase → Assign cell to “-” + Cellvalue

4th
Use [Write Range]-Activity to reprint the modified DT in excel.

Regards

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