How do I define the signum function sign(x) in Excel?

J

Jonathan

I am trying to define the function sign(x) in Excel. Sign (x) = 1 if x>0,
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.
 
J

Jazzer

Hi,

You could try something like this:

=MAX(SIGN(A1),0)

so that your number is in A1.

- Asser
 
T

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top