SGN(number)

Returns the sign of a number (Integer).


numberThe number you want the sign of.

REMARKS
* If "number" > 0, then 1 is returned.
* If "number" = 0, then 0 is returned.
* If "number" < 0, then -1 is returned.
* The equivalent .NET function is System.Math.Sign
* For the Microsoft documentation refer to docs.microsoft.com

Debug.Print Sgn(0)    '= 0  
Debug.Print Sgn(-1) '= -1
Debug.Print Sgn(1) '= 1
Debug.Print Sgn(50) '= 1
Debug.Print Sgn(-50) '= -1

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