Welcome to the Onshape forum! Ask questions and join in the discussions about everything Onshape, CAD, maker project and design.

First time visiting? Here are some places to start:

  1. Looking for a certain topic? Check out the categories filter or use Search (upper right).
  2. Need support? Ask a question to our Community Support category.
  3. Please submit support tickets for bugs but you can request improvements in the Product Feedback category.
  4. Be respectful, on topic and if you see a problem, Flag it.

If you would like to contact our Community Manager personally, feel free to send a private message or an email.

round( ) function

tim_ashbytim_ashby Member Posts: 1
Is it possible to specify the number of decimal places that the round( ) function rounds to? The standard Excel format of round(number, dp) doesn't seem to work. Alternatively, is there a workaround?. Thanks!

Best Answer

  • NeilCookeNeilCooke Posts: 1,519
    edited June 2016 Accepted Answer
    round(value * 100) / 100 should do the trick (to 2 dp)
    Neil Cooke, Director of Technical Marketing, Onshape Inc.

Answers

  • NeilCookeNeilCooke Moderator, Onshape Employees Posts: 1,519
    edited June 2016 Accepted Answer
    round(value * 100) / 100 should do the trick (to 2 dp)
    Neil Cooke, Director of Technical Marketing, Onshape Inc.
  • patrick_farleypatrick_farley Member Posts: 9
    round() as now a value and a multiple.
  • Jake_RosenfeldJake_Rosenfeld Moderator, Onshape Employees, Developers Posts: 941
    @patrick_farley

    round(value, .01) is probably what you are looking for rather than round(value, 2):
    https://cad.onshape.com/FsDoc/library.html#round--
    Jake Rosenfeld - Modeling Team
  • Jake_RosenfeldJake_Rosenfeld Moderator, Onshape Employees, Developers Posts: 941
    You'll notice also in that documentation that value and multiple can also both be valueWithUnits, and the result will come out as a plain number (whose "unit" corresponds to the "multiple")
    Jake Rosenfeld - Modeling Team
Sign In or Register to comment.