In Google Sheets, there are two quick ways to get the absolute value; with the absolute value, I mean a non-negative number. So, for example, for -5, the absolute value is 5; for 5, it’s 5.
Using ABS to Get the Absolute Value
In Google Sheets, a specific function called ABS allows you to convert a number into an absolute number.
=ABS(A2)
As I said, ABS is a pre-defined function in google sheets. And in the above example, you can see in column A that we have a number where a few numbers with a negative sign.
But when you use the ABS function, it returns a non-negative number.
And if you want to apply the to an entire range instead of a single in a single go, you can wrap it with the ArrayFormula.
=ARRAYFORMULA(ABS(A2:A9))
You need to enter the formula to the first cell and refer to the entire range instead of a single cell, close the formula, and hit enter to get the result in all the cells.
Using IF Condition to Convert a Negative Number into Positive
You can also use the IF function to test a number if it’s negative and then change it to a positive.
In this formula, you have used a condition to test whether the value in the cell is lower than zero. And if that value is lower than zero, then multiply that value with the -1.
And if that value is not lower than zero, get it as it is.
Note: When you multiply two negative values with each other, they return a positive value (absolute value).
You can also use the ArrayFormula function to apply this formula to an entire range.
=ArrayFormula(IF(A2:A9<0,A2:A9*-1,A2:A9))
Changing Only Format to Absolute Value
In Google Sheets, you can also change the format of a negative number into a positive by using a custom format.
Select the range of cells and then go to format> Number > Custom Number Format.
Once you click on the Custom Number Format, enter #,##0;#,##0 in the input bar, and then click Apply to apply the format.
And once you click Apply, it will change the format for all the selected cells.
In the above example, you can see the value in the cell is -10, but the value it shows is 10, which is an absolute value.