Convert Negative to Positive

J

John

Apologies for my itchy trigger finger and dual post.........full message
below:

Hi there,

I'm trying to use the ATAN2 function to return an ordered list of dynamic
connector shapes' angles. To do this I've add a user cell to the shape's
shapesheet with the following:

ATAN2((EndY-BeginY),(EndX-BeginX))

Thinking of a clock face this starts at 3 o'clock and runs anti-clockwise
from 0-180 degrees to 9 o'clock. From 9 to 3 o'clock it becomes negative
(ie -180 to 0).

So, I want to convert the negative numbers to their positve equivelant, such
as -90 + 360 = 270 degrees. So, the formula below should work:


=IF(ATAN2((EndY-BeginY),(EndX-BeginX))<0,(ATAN2((EndY-BeginY),(EndX-BeginX))+360),ATAN2((EndY-BeginY),(EndX-BeginX)))

........but it doesn't! (NB- For -45 deg it returns 20581.4 deg). Can anyone
tell me why?

Thanks

John
 
P

Paul Herber

Apologies for my itchy trigger finger and dual post.........full message
below:

Hi there,

I'm trying to use the ATAN2 function to return an ordered list of dynamic
connector shapes' angles. To do this I've add a user cell to the shape's
shapesheet with the following:

ATAN2((EndY-BeginY),(EndX-BeginX))

Thinking of a clock face this starts at 3 o'clock and runs anti-clockwise
from 0-180 degrees to 9 o'clock. From 9 to 3 o'clock it becomes negative
(ie -180 to 0).

So, I want to convert the negative numbers to their positve equivelant, such
as -90 + 360 = 270 degrees. So, the formula below should work:


=IF(ATAN2((EndY-BeginY),(EndX-BeginX))<0,(ATAN2((EndY-BeginY),(EndX-BeginX))+360),ATAN2((EndY-BeginY),(EndX-BeginX)))

.......but it doesn't! (NB- For -45 deg it returns 20581.4 deg). Can anyone
tell me why?

First thing to do is convert the '360' into '360 deg' as the default
angular measure in ATAN is radians.
 
J

John

Perfect. Many thanks Paul...........and I've even learnt about radians from
this too!

Thanks again

John
 
Joined
Nov 6, 2022
Messages
1
Reaction score
0
Apologies for my itchy trigger finger and dual post.........full message
below:

Hi there,

I'm trying to use the ATAN2 function to return an ordered list of dynamic
connector shapes' angles. To do this I've add a user cell to the shape's
shapesheet with the following:

ATAN2((EndY-BeginY),(EndX-BeginX))

Thinking of a clock face this starts at 3 o'clock and runs anti-clockwise
from 0-180 degrees to 9 o'clock. From 9 to 3 o'clock it becomes negative
(ie -180 to 0).

So, I want to convert the negative numbers to their positve equivelant, such
as -90 + 360 = 270 degrees. So, the formula below should work:


=IF(ATAN2((EndY-BeginY),(EndX-BeginX))<0,(ATAN2((EndY-BeginY),(EndX-BeginX))+360),ATAN2((EndY-BeginY),(EndX-BeginX)))

........but it doesn't! (NB- For -45 deg it returns 20581.4 deg). Can anyone
tell me why?

Thanks

John

Hi,

I am new on VISIO and working on same type of issue. I need +ive values when i rotate my shape in angle field. Please help me how i can use your formula to display positive angles?
 

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

Similar Threads


Top