Math and trigonometry functions

ABS

Refuses 2 of 1,383 recorded calls; the rest match

Of 1,383 recorded answers (1,227 in the answer bank and 156 workbook cells), 2 do not match: 2 are refused. How we measure this · See the Rust code

Local names in 40 languages
LanguageName in Excel
ArabicABS
BulgarianABS
CzechABS
DanishABS
GermanABS
GreekABS
English (Australia)ABS
English (United Kingdom)ABS
English (United States)ABS
SpanishABS
EstonianABS
FinnishITSEISARVO
FrenchABS
HebrewABS
CroatianABS
HungarianABS
IndonesianABS
ItalianASS
JapaneseABS
KoreanABS
LithuanianABS
LatvianABS
NorwegianABS
DutchABS
PolishABS
Portuguese (Brazil)ABS
Portuguese (Portugal)ABS
RomanianABS
RussianABS
SlovakABS
SlovenianABS
Serbian (Latin)ABS
SwedishABS
ThaiABS
TurkishMUTLAK
UkrainianABS
VietnameseABS
Chinese (Simplified)ABS
Chinese (Hong Kong)ABS
Chinese (Traditional)ABS

Names from Microsoft's support site.

What it does

ABS(number)

ABS(number) is the absolute value — the distance of number from zero on the real line:

|x|  =   x   if x >= 0
        -x   if x <  0
  • Domain: all real numbers.
  • Range: the non-negative reals, [0, +infinity).
  • Parity: even. |-x| = |x|, and this is the defining symmetry.
  • Smoothness: continuous everywhere, differentiable everywhere except at zero, where the left and right derivatives are -1 and +1. The corner at the origin is the whole reason ABS shows up in optimisation problems as the awkward term.
  • Algebra: |xy| = |x||y|, |x/y| = |x|/|y|, and the triangle inequality |x + y| <= |x| + |y| with equality exactly when x and y have the same sign. Absolute value is the standard norm on R; that is what makes ABS(a - b) the natural distance.

The identity that ties it to its sibling is x = SIGN(x) * ABS(x), exact for every x except that SIGN(0) is 0 and so contributes nothing at the origin.

In binary64 terms ABS is not an approximation of anything. The magnitude of a representable number is representable, so the correctly rounded result is the exact result: ABS clears the sign bit and leaves every other bit alone. Under IEEE 754 that makes it one of a very small set of operations — sign-bit operations — that are exact, cannot overflow, cannot underflow, and raise no exception on any input.

Arguments

ArgumentMeaningDefault
numberThe real number whose magnitude you want. Required.—

There is no commonly misunderstood position here, because there is only one. The misunderstanding that does occur is upstream of the call: readers reach for ABS to make a result positive when what they wanted was to make an argument positive, and the two differ whenever anything non-monotonic sits in between.

Try it

Input cells (optional)

Example: {"B2": 3, "B3": 4}. A1 holds the formula. Other cells need values before a formula can read them.

Enter a formula, then calculate.

Runs locally in your browser with OneCalc. Its answer may differ from Excel. Use English function names and commas between arguments.

Quirks

Result and edge cases

Returns Number.

  • Zero. |0| = 0. The interesting sub-case is negative zero: IEEE 754 distinguishes -0 from +0, and absolute value maps -0 to +0. Whether a negative zero can reach an Excel worksheet function at all, and what it displays as if it does, is not settled on this page.
  • Subnormals. Pass through with their magnitude unchanged; there is no underflow, because no arithmetic happens.
  • The largest finite double. Passes through unchanged; there is no overflow, for the same reason.
  • Logicals. Convert by the shared rule (TRUE to 1, FALSE to 0) before the kernel sees them.
  • Text that reads as a number. Converts as a direct argument under the shared to-number rule; text in a scanned range is a different question and does not arise for a unary kernel. A zero mantissa with an out-of-range exponent, such as "0e-309", does not convert: #VALUE! (FN-ABS-001).

Errors

ErrorConditionSource
#VALUE!The argument does not convert to a numberShared coercion rules, not an ABS-specific condition
propagatedAn error value in the argument is returned unchangedShared coercion rules

Text to number checks the exponent range even when the mantissa is zero

Converting text to a number, measured through ABS and VALUE, rejects a zero mantissa with an out-of-range exponent: ABS("0e-309") is #VALUE! though the text denotes 0, and ABS("0e-308") is 0. The exponent counts as written, less the fraction digits, less 2 for a percent sign, so ABS("0.0e309") is 0, ABS("0e309") is #VALUE!, and ABS("0e-307%") is #VALUE!.

Explanation (inferred): The exponent formula is inferred, though it fits every reading; that functions other than ABS and VALUE share this conversion is inferred.

FormulaExcelMathematical value
=ABS("0e-309")
Excel build not recorded in this run; bulk captures of the same date (2026-09-29) record Excel 16.0 build 20430, Windows 64-bit, workbook compatibility 2
Inputs and reference value

Typed formula.

The text denotes zero: a zero mantissa is 0 at any exponent.

#VALUE!0
0x0000000000000000
=ABS("0e-308")
Excel build not recorded in this run; bulk captures of the same date (2026-09-29) record Excel 16.0 build 20430, Windows 64-bit, workbook compatibility 2
Inputs and reference value

Typed formula.

0
0x0000000000000000
—
=ABS("0e-307%")
Excel build not recorded in this run; bulk captures of the same date (2026-09-29) record Excel 16.0 build 20430, Windows 64-bit, workbook compatibility 2
Inputs and reference value

Typed formula.

#VALUE!—
=ABS("0e309")
Excel build not recorded in this run; bulk captures of the same date (2026-09-29) record Excel 16.0 build 20430, Windows 64-bit, workbook compatibility 2
Inputs and reference value

Typed formula.

The text denotes zero: a zero mantissa is 0 at any exponent.

#VALUE!0
0x0000000000000000
=ABS("0.0e309")
Excel build not recorded in this run; bulk captures of the same date (2026-09-29) record Excel 16.0 build 20430, Windows 64-bit, workbook compatibility 2
Inputs and reference value

Typed formula.

0
0x0000000000000000
—
=VALUE("0e-307")
Excel 16.0.20527.20088 Current Channel, Windows 64-bit (NT 10.0.26200), x86-64, AMD Ryzen 7 4800H, en-ZA
Inputs and reference value

Typed formula.

0
0x0000000000000000
—
=VALUE("0e-307%")
Excel 16.0.20527.20088 Current Channel, Windows 64-bit (NT 10.0.26200), x86-64, AMD Ryzen 7 4800H, en-ZA
Inputs and reference value

Typed formula.

#VALUE!—
=VALUE("0e309")
Excel 16.0.20527.20088 Current Channel, Windows 64-bit (NT 10.0.26200), x86-64, AMD Ryzen 7 4800H, en-ZA
Inputs and reference value

Typed formula.

#VALUE!—
=VALUE("0.0e309")
Excel 16.0.20527.20088 Current Channel, Windows 64-bit (NT 10.0.26200), x86-64, AMD Ryzen 7 4800H, en-ZA
Inputs and reference value

Typed formula.

0
0x0000000000000000
—
=VALUE("0e309%")
Excel 16.0.20527.20088 Current Channel, Windows 64-bit (NT 10.0.26200), x86-64, AMD Ryzen 7 4800H, en-ZA
Inputs and reference value

Typed formula.

0
0x0000000000000000
—
=VALUE("0e311%")
Excel 16.0.20527.20088 Current Channel, Windows 64-bit (NT 10.0.26200), x86-64, AMD Ryzen 7 4800H, en-ZA
Inputs and reference value

Typed formula.

#VALUE!—

Inputs, build details and evidence

How to implement

Numerical notes

ABS is the rare function whose numerical note is that it has no numerical error. Everything interesting happens on either side of it.

The comparison idiom. ABS(a - b) < tol is the standard floating-point equality test, and the error in it belongs entirely to the subtraction. Sterbenz's lemma gives the good case: if a and b are within a factor of two of each other, a - b is computed exactly, so ABS(a - b) is the exact distance. Outside that band the subtraction rounds, and for widely separated magnitudes it can round to something with no correct digits at all. ABS faithfully reports whatever the subtraction produced; readers who see a surprising result from this idiom are looking at the wrong function.

Absolute versus relative tolerance. A fixed tol in the idiom above is an absolute tolerance, and it is meaningful only over a narrow range of magnitudes. The relative form ABS(a - b) <= tol * ABS(b) scales correctly but fails when b is zero. The mixed form ABS(a - b) <= tol * MAX(ABS(a), ABS(b), 1) is the usual compromise, and it is worth writing out rather than reaching for, because the choice is a modelling decision and not a numerical one.

Why implementations should not branch. The obvious implementation — compare against zero, negate if negative — is correct but has two defects: it is a branch on data, and it maps -0 to -0 rather than to +0 unless the comparison is written carefully. Clearing the sign bit has neither problem. Any implementation claiming ABS should be checked at -0 for exactly this reason.

ABS as a guard. A common pattern wraps a domain-restricted function in ABS to keep its argument admissible — SQRT(ABS(x)), LN(ABS(x)). This silently changes the function being computed. The Handbook notes it because it turns a #NUM! into a plausible wrong answer, which is the worse of the two failures.

Rust code

Show the CalcFunc source of this function

Quoted from the public repository DnaCalc/DnaCalc, crates calc-func and calc-fml, at commit 9e1884369a67. Comments are the source's own. A kernel shared with other functions appears once, on its module page.

ABS · 1 lines · calc-func/src/catalogue/rounding.rs on GitHub
call(ABS, "ABS", 1, NUMBER, abs)

Kernels shared with other functions

Argument and result plumbing

No implementation has been published with a Handbook test suite for this function.

Version differences

The recorded environments below distinguish a reading from a same-input comparison. Counts describe captured inputs in each environment; overlapping captures and comparisons are not totals of unique worksheet calls.

Excel 16.0 buildPlatform and CPUCaptured inputs
19929Windows, bitness not recorded, CPU not recorded40
20430Windows, 64-bit, CPU not recorded1,227
  • XC-ABS-001: build 19929 versus build 20430; 2 same-input pairs, 0 differing answers. Compared axes: excel-build. Numeric answers were compared by their recorded binary64 bits; other answers by typed value.

Agreement on these compared inputs does not establish agreement on unmeasured inputs.

Recorded environments and comparison details.

Excel 16.0 build 19929

Windows, bitness not recorded, CPU not recorded

40 captured inputs are indexed for this environment. Capture dates are not recorded. This is a reading count, not a comparison with another build.

Excel 16.0 build 20430

Windows, 64-bit, CPU not recorded

1,227 captured inputs are indexed for this environment. Capture dates: 2026-09-29 to 2026-09-29. This is a reading count, not a comparison with another build.

Alternatives

Relationships

  • SIGN — the other half of the polar decomposition of a real number. SIGN(x) * ABS(x) = x away from the origin.
  • IMABS — the complex modulus, which is the same idea one dimension up and not the same computation: it is hypot(a, b), an operation with real overflow and cancellation questions, where the real ABS has none.
  • Unary minus — ABS is not "negate if negative" implemented as a comparison plus a negation; it is a single sign-bit clear. The distinction is invisible in results and visible in performance.
  • SUMSQ, SUMXMY2, DEVSQ — squaring is the other standard way to discard a sign, and it is the one that overflows. Where a formula can use either, ABS has the wider range.
  • AVEDEV — the mean absolute deviation, which is ABS under an aggregate, and the reason the function exists in the statistical category at all.
  • Confused with: INT and TRUNC, which also "simplify" a number but change its magnitude; ABS never does.

Named variants

No named variants are recorded yet.

Suggest a correction or contribute an implementation · For agents