# Worksheet function changing a negative to a positive

## Recommended Posts

I have a worksheet I have made. Now I have two columns one that is my x position and one that is my y position. For a number of reasons the y position origin starts above all the stuff I want the coordinates of. Meaning everything is a negative y. This is intentional. However I don't want my worksheet to report -y I just want it to report y. Everything is negative so really it doesn't matter.

Here is my line:

=ROUND(YCENTER/12)

I have tired adding a *-1 in there, but that doesn't work. What can I do to make this a positive instead of a negative?

Try =-Round(YCENTER()/12)

It works for me here on VW2008 SP3.

Make sure you are on the latest service pack if it is not working.

Pat

Wow should have thought of that huh. It has been a while since the math classes.

I had a similar situation where I needed all the values to return a positive valuse regardless if the original value was negative or positive.

I did the following (N being the original number)

(N?) [sqaure root of N].

Basically multiplying any value by itself wether negitive or positive returns a positive value. (+ x + = +), (- x - = +).

Then I just take the sqaure root of that value and done. Hope that helps.

I have not tried it but have checked its in the VW documentation which it is, but in normal Pascal, the ABS (absolute) function will convert any number to a positive.

ABS is available as a vectorscript function, but not all VS functions are available for use in Worksheets. This is one of the ones that is not available.

Pat

Pat

I just checked to see what other functions were and were not available for Worksheets.

Is this a bug?: I put the value -2 in a field (A3). I entered =SQRT(A3) into A4. It returned 1.414

Michael

If I remember my math correctly, you can't take a square root of a negative number, so I would think that is a bug.

Pat

You can, but the result is an imaginary number.

Do worksheet values always truncate at 3 decimal places?

Michael

Under the General cell format it is. If you want more decimal places, set the cell format to Decimal and you can set the decimals to what you want.

By the way, the sqrt(-2) = 1.414 works (bugs) on VW2009 also.

Pat

## Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

×   Pasted as rich text.   Restore formatting

Only 75 emoji are allowed.

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×

• KBASE
• #### MARIONETTE

×
• Create New...