Jump to content

Getting an absolute value of a number in a worksheet


JMR

Recommended Posts

Hi,

 

I ran into a problem where a component list displays negative numbers for extrude lengths. How to get an absolute value?

 

I'm posting this here since the thread where I found the solution is eleven years old:

 

https://forum.vectorworks.net/index.php?/topic/23463-worksheet-function-changing-a-negative-to-a-positive/&tab=comments#comment-110335

 

Eg. for the length of an extrude, this always returns a positive (absolute) value:

 

=SQRT(LENGTH*LENGTH)

 

Brilliant.

 

 

Link to comment

Did that solution come from @michaelk? It looks like one of his math major things.

 

I probably would have used

 

=IF(Length>=0, Length, Length*-1) 

 

 

If this is something that you use a lot, it may be possible to write a Worksheet Script that would be called something like  =Runscript('WS_ABS','A2') to return the absolute value of the data in cell A2.  It is too late tonight to figure out the detail, but I think it is doable.

 

  • Like 1
Link to comment

It was someone called CS1, apparently not active since 2013. 

 

Probably others have figured this out too.

 

Thanks Pat, that's a great idea since the ABS function is not available in the worksheet functions menu. 

Link to comment

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

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

×
×
  • Create New...