Jump to content
  • Rounding a Price

       (0 reviews)

    Darth Moxy

    There is now a rounding feature available for pricing and part formulas, you'll see instructions on the way to use them in the 'more help' section above your formulas:

    image.thumb.png.85ddbb825c3980a86a924e2a53265da3.png

     

    image.thumb.png.27fc54c87b40c36f116977aba050779c.png

     

    As you can see you'll wrap the part of your formula you want rounded (could be a small part of it or the whole entire thing) and with parenthesis and put the 'floor,' 'ceiling,' or 'round' function before it.

    Round functions as typical rounding - if the end of the value is .5 or more it will round up, if it's less than .5 it will round down.

    Floor will round always round the fraction DOWN, even if the value ends in .99

    Ceiling will always round the function UP, even if the value ends in .01

    Also note that if you don't want to round to whole numbers, you'll additionally divide the formula by 10, 100 or 1000 depending on how many decimal places you're hoping to get.

     

    Here's an example of what I would do if I wanted to round my simple sqft*cost formula to the nearest whole number:

    round (((height * width)/144)) * wood_type.cost)

     

    - - - - - - - - - - - - - - 

    But if there's a place you find where you can't use this function, here's another way (the old way you would have used before this function was built) you can do something like this in your formula...

    You'll use "IF" statements in your pricing to say "If square footage X 1.85 is less than 2, give me 2. If it's less than 3, give me 3.... etc. But you'll have to go as high as you think you need to, to cover all possible prices your customers might encounter. The IF statement would look similar to what I've posted below:

    ((((height * width)/144)) * 1.85 < 2 ? 2 :

    ((((height * width)/144)) * 1.85 < 3 ? 3 :

    ((((height * width)/144)) * 1.85 <4 ? 4 :

    ((((height * width)/144)) * 1.85 < 5 ? 5 :

    ((((height * width)/144)) * 1.85 < 6 ? 6 :

    ((((height * width)/144)) * 1.85 < 7 ? 7 :

    ((((height * width)/144)) * 1.85 < 8 ? 8 : 9)))))))

    You'll see I've only gone up to $9 dollars here, but it can go on as long as you need it to. And in place of the 1.85 you'll probably have some sort of sq ft price variable instead - and use your own height and width variables if they are worded differently. 

     

    User Feedback

    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

×
×
  • Create New...

Important Information

Terms and conditions of this site