SGN

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 learn.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

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