ABS(number)

Returns the absolute value of a number (Variant).


numberThe number you want the absolute of (Variant).

REMARKS
* The absolute value of a number is the number without its sign.
* The data type of the value returned is the same as the data type of the number passed in.
* The "number" can be any valid numeric expression.
* If "number" is Null, then Null is returned.
* If "number" is an uninitialised variable, then 0 is returned.
* The equivalent Excel function is Application.WorksheetFunction.ABS
* The equivalent .NET function is System.Math.Abs

Debug.Print Abs(1)           '= 1  
Debug.Print Abs(-1) '= 1
Debug.Print Abs(-2.4) '= 2.4
Debug.Print Abs(Null) '= Null
Debug.Print TypeName(Abs("integer")) '= "Integer"
Debug.Print TypeName(Abs("single")) '= "Single"
Debug.Print TypeName(Abs("double")) '= "Double"
Debug.Print TypeName(Abs("string")) '= "Double"
Debug.Print TypeName(Abs("boolean")) '= "Integer"

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