Change Positive value to negative and negative to positive

Hello Guys, I need help changing some of the values of the amount column to negative and the others to positive. That is any negative value should be changed to positive and any positive value should be changed to negative. Do the data looks like this:

Amount
-1000
4500
6000
-2500
-3000
-35000
-60000
90000

I want to change the negative ones to positive and the positive ones to negative.

I have tried this fuction Math.Abs(Double.Parse(“-Amount_Col”)) but I keep getting error that the input format is not correct.

Please help.

Thank you.

To change a positive number to negative subtract it from 0.

0 - posNumber = negNumber

To change a negative number to positive multiply it by -1

negNumber * -1 = posNumber

Hi @Lamina_Zafrullah

What about the following?

(CDbl(CurrentRow("Amount").ToString) * (-1) )

image

Regards!

Thanks @postwick But can you please walk me through the function to use.

I am using fill range activity to fill the column. Please note that I have both the positive and negative values on the same column. Please I am new to UiPath, what function will place in the what to write section of the fill range activity.

Thank you

Thank you @fernando_zuluaga . It worked perfectly. Thanks

1 Like

Hello @fernando_zuluaga please how do I do the sum total of the amount column

dtInput.AsEnumerable().Sum(Function(x) CDbl(x("Amount").ToString().Trim())).ToString

image

Thank you @fernando_zuluaga. After the sum-up, the final output ought to be positive. That is 190571872.419998 but it’s showing -190571872.419998. This is because all the values in the amount column are negative and I have changed it to positive. I am now surprised how the sum is returning a negative value. Please help

Sorry to bother you again, please.

How can I convert this date: 2/10/2023 12:00:00 AM to 10-Feb-2023.

Thank you

Hi @Lamina_Zafrullah

please keep this topic closed with 1 topic to discuss, create more topics for different querys, so people will seach the specific query at the correct topic, you can create more topics and tag me, if i can help you ill be there to help, if not, more people will came to help us!

Regards

Okay, thanks.

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