Lesson 71 of 92 · Free Excel Course
Excel · Excel function reference
Excel ABS Function: Syntax, Examples and Common Errors
How the Excel ABS function returns a number without its sign: variances either way, total absolute difference with SUMPRODUCT, tolerance checks and fixes.
The ABS function returns the absolute value of a number: the same number with its minus sign taken off. =ABS(-250) returns 250, =ABS(250) returns 250, and =ABS(0) returns 0. The result is always zero or positive. On its own that sounds trivial, but inside other formulas ABS answers a very common question: "how far apart are these two numbers, whichever way round?" That's what you need for budget misses, forecast errors and checking that a measurement is close enough to its target. ABS is available in Excel for Microsoft 365 (Windows, Mac and the web), Excel 2024, Excel 2021, Excel 2019 and Excel 2016.
Syntax
=ABS(number)
- number (required): the number you want the absolute value of. It can be typed in, a cell reference such as B2, or a calculation such as
C2-B2. There is only one argument and no optional ones.
ABS never changes the cell it reads. It returns a new value in the cell where you type the formula, and the original stays negative.
Examples
Microsoft's example
This is the example from Microsoft's ABS page: -4 is in A2, and the three formulas give these results.
| A | B | C | |
|---|---|---|---|
| 1 | Data | Formula | Result |
| 2 | -4 | =ABS(2) | 2 |
| 3 | =ABS(-2) | 2 | |
| 4 | =ABS(A2) | 4 |
How far off budget, in either direction
A plain subtraction tells you the direction (over is positive, under is negative). Wrap it in ABS when you only care about the size of the miss, for example to flag every line that is more than 10% away from budget, high or low.
| A | B | C | D | E | |
|---|---|---|---|---|---|
| 1 | Line | Budget | Actual | Off by | Over 10%? |
| 2 | Travel | $2,000 | $2,300 | $300 | TRUE |
| 3 | Software | $1,200 | $1,050 | $150 | TRUE |
| 4 | Supplies | $800 | $760 | $40 | FALSE |
| 5 | Marketing | $3,000 | $2,900 | $100 | FALSE |
Without ABS, the 10% test in column E would only catch overspends: Software's -12.5% is not greater than 10%. With ABS it catches both Travel (15% over) and Software (12.5% under).
Total absolute difference with SUMPRODUCT
Adding up plain differences is misleading because overs and unders cancel out. Here the four lines miss by $590 in total, yet the net difference is only $10.
| A | B | C | |
|---|---|---|---|
| 1 | Line | Budget | Actual |
| 2 | Travel | $2,000 | $2,300 |
| 3 | Software | $1,200 | $1,050 |
| 4 | Supplies | $800 | $760 |
| 5 | Marketing | $3,000 | $2,900 |
| 6 | Net difference | $10 | |
| 7 | Total miss | $590 |
C2:C5-B2:B5 works out four differences, ABS makes each one positive, and SUMPRODUCT adds them up without needing a helper column. Divide by the count to get the average miss: =SUMPRODUCT(ABS(C2:C5-B2:B5))/COUNT(B2:B5) gives $147.50. Forecasters call this the mean absolute error. To find the single biggest miss either way, =MAX(ABS(C2:C5-B2:B5)) returns $300 (press Ctrl+Shift+Enter in Excel 2019 and older).
Tolerance check: close enough?
To test whether a value is within a tolerance of its target, compare the absolute difference with the tolerance. This is how you check measurements, reconcile two totals that should match to the cent, or compare a formula's answer with a known one.
| A | B | C | |
|---|---|---|---|
| 1 | Target | Measured | Within 0.05? |
| 2 | 10.00 | 10.03 | TRUE |
| 3 | 10.00 | 9.97 | TRUE |
| 4 | 10.00 | 10.08 | FALSE |
Put the tolerance in its own cell (say E1) and use =ABS(B2-A2)<=$E$1 so you can change it in one place. For a pass/fail label, wrap it in IF: =IF(ABS(B2-A2)<=$E$1,"OK","Check").
Common errors
- #VALUE! The argument is text that isn't a clean number, such as "45 USD" or a number pasted with a non-breaking space. ABS doesn't strip text. Clean the data first (see the VALUE function and import, export and convert).
- ABS doesn't fix numbers stored as text. Even when ABS can read a text number, it only changes its own result: the original column is still text, so
=SUM(B2:B20)keeps skipping those cells. Convert the column itself. - The sign was the information. ABS throws away direction. If you need to know whether a line was over or under budget, keep the plain difference in one column and use ABS only for size tests and totals.
- A tolerance test fails on the boundary. Decimals are stored in binary, so 10.05 minus 10 may be a hair more than 0.05 and
=ABS(B2-A2)<=0.05returns FALSE. Round the difference first:=ROUND(ABS(B2-A2),4)<=0.05. - Wrong range sizes. In
SUMPRODUCT(ABS(C2:C5-B2:B5))both ranges must be the same size. If one is longer, the extra rows have nothing to subtract from, they come out as #N/A, and the whole total becomes #N/A. - An empty cell gives 0, not an error, so a missing value can quietly look like a perfect match. Check for blanks with COUNTBLANK if it matters.
Related functions
- Formulas: the basics and subtract, multiply and divide: the lessons on building calculations like
C2-B2. - MOD function: pair it with ABS to get the decimal part of negative numbers.
- POWER function: the other single-number math function.
- Percentages: uses ABS when the starting number of a percent change is negative.
Try it yourself
Download the practice workbook. The Practice sheet has yellow cells for a budget miss, a 10% flag, the total miss with SUMPRODUCT, a tolerance check and the biggest daily swing. The Answers sheet has the working formulas so you can compare each result.
Frequently asked questions
How do I turn negative numbers into positive numbers in Excel?
Put =ABS(A2) in a spare column and copy it down. To replace the originals, copy the ABS column, then use Paste Special > Values over the old numbers and delete the helper column. Positive numbers and zero stay as they are.
Is the ABS function the same as an absolute reference?
No. ABS removes a minus sign from a number. An absolute reference is the $ in $A$1, which stops a cell address from changing when you copy a formula. They only share the word "absolute". The $ is explained in absolute and relative references.
How do I sum absolute values in Excel?
Use =SUMPRODUCT(ABS(A2:A10)). SUMPRODUCT handles the range without any special keys. In Excel for Microsoft 365 and Excel 2021 or later, =SUM(ABS(A2:A10)) works too; in Excel 2019 and older that version needs Ctrl+Shift+Enter.
How do I find the difference between two numbers regardless of which is bigger?
Subtract them and wrap the result in ABS: =ABS(A2-B2). It gives the same positive answer whichever number is larger, so 120 and 95 give 25 either way round.