If you only need to convert negative numbers once, you can convert in-place with Paste Special: Add -1 to a cell and copy to the clipboard. Select the negative numbers you want to convert. Use Paste Special > Values + Multiply.
In this article, we will learn about how to use absolute value function to convert negative numbers to positive numbers in Excel. ABS function returns the Absolute value of a number, without its sign. Absolute value means negative number are converted to positive and the positive numbers stay unaffected.
>>> n = -42
>>> -n # if you know n is negative
42
>>> abs(n) # for any n
42
Don't forget to check the docs.
simply multiplying by -1 works in both ways ...
>>> -10 * -1
10
>>> 10 * -1
-10
If "keep a positive one" means you want a positive number to stay positive, but also convert a negative number to positive, use abs()
:
>>> abs(-1)
1
>>> abs(1)
1
The inbuilt function abs() would do the trick.
positivenum = abs(negativenum)
In [6]: x = -2
In [7]: x
Out[7]: -2
In [8]: abs(x)
Out[8]: 2
Actually abs
will return the absolute value
of any number. Absolute value is always a non-negative number.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With