ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   How do I define the signum function sign(x) in Excel? (https://www.excelbanter.com/excel-worksheet-functions/6005-how-do-i-define-signum-function-sign-x-excel.html)

Jonathan

How do I define the signum function sign(x) in Excel?
 
I am trying to define the function sign(x) in Excel. Sign (x) = 1 if x0,
sign(x)=0 if x<0 and sign(0)=0. I know that it is probably straightforward to
do as an if statement, but I wondered if there is just an explicit function
in Excel that would do it for me.

Jazzer


Hi,

You could try something like this:

=MAX(SIGN(A1),0)

so that your number is in A1.

- Asser


--
Jazzer
------------------------------------------------------------------------
Jazzer's Profile: http://www.excelforum.com/member.php...fo&userid=4464
View this thread: http://www.excelforum.com/showthread...hreadid=276583


Tushar Mehta

Do you really mean sign(x)=0 if x<0? If not (and you meant sign(x)=-1
if x<0), then check XL help for the SIGN function.

--
Regards,

Tushar Mehta
www.tushar-mehta.com
Excel, PowerPoint, and VBA add-ins, tutorials
Custom MS Office productivity solutions

In article ,
says...
I am trying to define the function sign(x) in Excel. Sign (x) = 1 if x0,
sign(x)=0 if x<0 and sign(0)=0. I know that it is probably straightforward to
do as an if statement, but I wondered if there is just an explicit function
in Excel that would do it for me.


Bernie Deitrick

Jonathan,

=IF(x0,1,0)

HTH,
Bernie
MS Excel MVP

"Jonathan" wrote in message
...
I am trying to define the function sign(x) in Excel. Sign (x) = 1 if x0,
sign(x)=0 if x<0 and sign(0)=0. I know that it is probably straightforward

to
do as an if statement, but I wondered if there is just an explicit

function
in Excel that would do it for me.




Bernd

The sign function is in Excel, but you defined something
like:
=--(A10)


Regards,
Bernd


All times are GMT +1. The time now is 09:01 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com