abs

abs(x) -> T

Returns the absolute value of a number (built-in).

xThe number you want the absolute of.

REMARKS
* This is a built-in function.
* The absolute value of a number is the number without its sign.
* The "x" can be an integer, a floating point number or a complex number.
* This function will return a value that has the same data type as "x".
* If the argument is a complex number, its magnitude is returned.
* You can use the math.fabs function to
* The equivalent VBA function is ABS
* The equivalent Excel function is ABS
* For the Official documentation refer to python.org

myvar = abs(-12) 
print(myvar) #= 12
print(type(myvar)) #= <class 'int'>

myvar = abs(-12.5)
print(myvar) #= 12.5
print(type(myvar)) #= <class 'float'>

myvar = abs(True)
print(myvar) #= 1
print(type(myvar)) #= <class 'int'>

myvar = abs(False)
print(myvar) #= 0
print(type(myvar)) #= <class 'int'>

myvar = abs('text')
TypeError: bad operand type for abs(): 'str'

© 2026 Better Solutions Limited. All Rights Reserved. © 2026 Better Solutions Limited Top