The function computes the absolute value of a number, returning its non-negative magnitude regardless of sign. It is widely used across programming languages and spreadsheet tools to ensure values are positive, especially in mathematical, financial, and data analysis contexts.

Excel

In Excel, the ABS function returns the absolute value of a number.

  • Syntax: =ABS(number)

  • Examples:

    • =ABS(-5) returns 5

    • =ABS(A1) returns the absolute value of the number in cell A1

    • =ABS(A1-B1) calculates the absolute difference between values in A1 and B1

  • It supports integers, decimals, cell references, and mathematical expressions.

Python

In Python, the abs() function returns the absolute value of an integer or float.

  • Syntax: abs(x)

  • Examples:

    • abs(-45) returns 45

    • abs(-3.14) returns 3.14

  • Works with integers, floats, and complex numbers (returns magnitude).

C/C++

In C, abs() is part of the stdlib.h library and returns the absolute value of an integer.

  • Syntax: int abs(int x);

  • Example: abs(-10) returns 10

  • For floating-point numbers, use fabs() (from math.h).

  • Note: abs(INT_MIN) may cause overflow in 32-bit systems.

SQL

In SQL, ABS() returns the absolute value of a numeric expression.

  • Syntax: SELECT ABS(expression) FROM table;

  • Example: SELECT ABS(temperature - 25) FROM temperature_readings; calculates absolute temperature deviation.

Other Tools

  • Smartsheet: ABS(number) ensures results are positive, useful for variance or date difference calculations.

  • R: abs(x) computes absolute values for vectors and scalars.

  • CNC (G-code): abs[x] returns the absolute value of a number.

  • Ultra Fractal: abs(a + bi) computes the magnitude of a complex number.

Key Use Cases:

  • Calculating distances or differences

  • Normalizing data

  • Error handling with negative error codes

  • Financial variance analysis

  • Ensuring positive outputs in conditional logic

Always ensure correct data types are used—e.g., use fabs() in C for floats, and avoid applying ABS to text or non-numeric values to prevent errors.

🌐
Microsoft Support
support.microsoft.com › en-us › office › abs-function-3420200f-5628-4e8c-99da-c99d7c87713c
ABS function - Microsoft Support
Returns the absolute value of a number. The absolute value of a number is the number without its sign.
nonnegative number with the same magnitude as a given real number
wiki AbsoluteValue 2
wiki AbsoluteValue 4
wiki AbsoluteValue 8
In mathematics, the absolute value or modulus of a real number ... {\displaystyle |0|=0} . For example, the absolute value of 3 is 3, and the absolute value of −3 is also … Wikipedia
Factsheet
Notation vertical bar brackets
Factsheet
Notation vertical bar brackets
🌐
Wikipedia
en.wikipedia.org › wiki › Absolute_value
Absolute value - Wikipedia
1 month ago - The real absolute value function is continuous everywhere. It is differentiable everywhere except for x = 0. It is monotonically decreasing on the interval (−∞, 0] and monotonically increasing on the interval [0, +∞). Since a real number and its opposite have the same absolute value, it is an even function, and is hence not invertible.
People also ask

What is the difference between ABS and SIGN functions?
ABS returns the absolute value (magnitude without sign), always producing positive results or zero. SIGN, conversely, returns only the sign indicator: 1 for positive numbers, -1 for negative numbers, and 0 for zero. Use ABS when you need the actual magnitude, and SIGN when you only need to determine the direction or sign of a value.
🌐
getelyxai.com
getelyxai.com › excel formulas › math and trigonometry › abs
ABS Excel Formula: Get Absolute Values Easily | ElyxAI
How do I use ABS with conditional logic or IF statements?
Combine ABS with IF using syntax like =IF(ABS(A1-B1)>100, 'Large Variance', 'Small Variance'). This allows you to flag values based on absolute magnitude thresholds. You can also nest ABS within SUMIF or AVERAGEIF for conditional aggregations: =SUMIF(range, criteria, ABS(values)).
🌐
getelyxai.com
getelyxai.com › excel formulas › math and trigonometry › abs
ABS Excel Formula: Get Absolute Values Easily | ElyxAI
What happens if I apply ABS to zero?
=ABS(0) returns 0. Zero is neither positive nor negative, and its absolute value remains zero. This is mathematically correct and useful in formulas where zero values might appear naturally in your data, such as in variance calculations or difference measurements.
🌐
getelyxai.com
getelyxai.com › excel formulas › math and trigonometry › abs
ABS Excel Formula: Get Absolute Values Easily | ElyxAI
🌐
Easymorph
help.easymorph.com › doku.php
Abs(number) [EasyMorph Help]
This function returns the absolute value of number which is the distance of a number on the number line, from 0, without considering which direction the number lies
🌐
ElyxAI
getelyxai.com › excel formulas › math and trigonometry › abs
ABS Excel Formula: Get Absolute Values Easily | ElyxAI
The number parameter accepts various input types including direct numeric values (e.g., -45, 3.14), cell references (e.g., A1, B5), mathematical expressions (e.g., A1-B1), or even results from other functions (e.g., SUM(A1:A10)). When you execute the formula, Excel evaluates the parameter and returns its absolute value—the non-negative equivalent regardless of the original sign.
🌐
W3Schools
w3schools.com › python › ref_func_abs.asp
Python abs() Function
The abs() function returns the absolute value of the specified number.
🌐
Smartsheet
help.smartsheet.com › function › abs
ABS Function | Smartsheet Learning Center
This function removes a negative state without changing the numeric value for negative results, while not impacting positive values. ... The ABS function converts any number to its absolute value, which is a positive number reflecting how far ...
Find elsewhere
🌐
F-Chart Software
fchartsoftware.com › ees › eeshelp › _abs.htm
ABS
In complex mode, ABS(Arg) will return the Magnitude of a complex number. In real mode, ABS(Arg) returns the absolute value of the argument. Mathematical functions
🌐
Alteryx
help.alteryx.com › aac › en › trifacta-classic › wrangle-language › math-functions › abs-function.html
ABS Function
Computes the absolute value of a given numeric value. The value can be a Decimal or Integer literal or a reference to a column containing numeric values. Wrangle vs. SQL: This function is part of Wrangle, a proprietary data transformation language. Wrangle is not SQL.
🌐
Oreate AI
oreateai.com › blog › a-detailed-explanation-of-the-cc-abs-function-from-principles-to-practical-applications › 98179184802234d17e6a4a7370fbad68
A Detailed Explanation of the C/C++ Abs Function: From Principles to Practical Applications - Oreate AI Blog
January 7, 2026 - The absolute value function abs ... core functionality of this function is to return the absolute value of any integer, which represents its distance from zero on a number line....
🌐
Hightouch
hightouch.com › sql-dictionary › sql-abs
SQL ABS - Syntax, Use Cases, and Examples | Hightouch
December 29, 2023 - The SQL ABS function is used to calculate the absolute (non-negative) value of a numeric expression or column in a database table.
🌐
TutorialsPoint
tutorialspoint.com › c_standard_library › c_function_abs.htm
C library - abs() function
The C stdlib library abs() function is used to returns the absolute value of the specified number, where absolute represents the positive number. This function only returns the positive integer.
🌐
Stats with R
statswithr.com › r-functions › the-abs-function-in-r
The “abs” Function in R
January 18, 2026 - In this example, abs is a built-in function in base R, and it is used to compute the absolute values of numeric vectors or values. The x argument is the required numeric vector or value for which the absolute values are calculated.
🌐
MDN Web Docs
developer.mozilla.org › en-US › docs › Web › JavaScript › Reference › Global_Objects › Math › abs
Math.abs() - JavaScript | MDN
The absolute value of x. If x is negative or -0, returns its opposite number -x (which is non-negative). Otherwise, returns x itself.
🌐
Arduino
docs.arduino.cc › language-reference › en › functions › math › abs
abs()
April 25, 2025 - Arduino programming language can be divided in three main parts: functions, values (variables and constants), and structure.
🌐
Cnc
cnc.zone › gcode › functions › func-abs
abs[] [CNC.Zone]
January 26, 2023 - The abs[] function is a function that returns the absolute value of a number. The absolute value of a number is the number without its sign, so if the input is a negative number, the function returns the positive version of that number.
🌐
ExcelFind
excelfind.com › excel-functions › excel-abs-function
How to use the Excel ABS function - ExcelFind.com
February 12, 2024 - The Excel ABS function returns the absolute value of a number. Absolute value refers to the distance of a number from zero, disregarding its sign.
🌐
IBM
ibm.com › docs › en › cobol-zos › 6.3.0
ABS
The ABS function returns the absolute value of the argument.
🌐
Salesforce
help.salesforce.com › s › articleView
abs Function
Loading · ×Sorry to interrupt · Refresh · Select An Org · Open Main Menu · Close · Modal Body · Salesforce Help | Article