What is the ABS function?
=ABS(number)ABS returns the absolute value of a number, the number without its sign. Use it to compare differences or errors regardless of direction.
Positive numbers and 0 stay the same; negative numbers become positive.
ABS checks whether a measurement is within tolerance of its target, or compares the size of budget variances. Because it measures only the size of a difference, not its direction, it is usually paired with IF.
Arguments
- number
- The number or cell to get the absolute value of.
ABS examples
Example 1. Example from Microsoft
=ABS(-2)Returns 2.
Example 2. Size of a difference
=ABS(B2-C2)The gap between target and actual, without a sign.
Example 3. Pass or fail on tolerance
=IF(ABS(B2-C2)<=0.05, "OK", "NG")Passes when the measured value C2 is within ±0.05 mm of the spec B2.
Spec B2 Measured C2 ABS(B2-C2) Result 10.00 10.03 0.03 OK 10.00 9.94 0.06 NG 10.00 9.96 0.04 OK Example 4. Total size of the variances
=SUMPRODUCT(ABS(C2:C10-B2:B10))Adds budget-versus-actual differences without signs, so overs and unders do not cancel out.
Common mistakes
Numbers stored as text
A number stored as text such as "-5" may need to be converted to a number first.
Losing the sign by accident
ABS changes the value, so the original sign is gone. Keep the original column if you still need it.
ABS after SUM
=ABS(SUM(differences)) is what is left after the differences cancel. For the total variance, take ABS of each one first.
FAQ
- How do I turn only negatives into 0?
- Use =MAX(A2, 0).
- Absolute value of a total?
- Wrap it: =ABS(SUM(A2:A10)).
- Why use it before SQRT?
- The square root of a negative number is #NUM!, so =SQRT(ABS(A2)) removes the sign first.