How can I round up a calculation? For instance:
(Total rounds /4) gives me 16.75
How do I round up the 16.75 to 17?
I've tried several FM online examples, but to no avail.
you do not need a second field - you can just nest the functions. Post #1 is how I would have answered your question. Post #2 suggests then standard mathematical rounding function. Combining the two would be:
Round ( TotalRounds / 4; 0 )
Ceiling ( Total rounds / 4 ) should do it
unless you want a value such as 16.25 to round to 16. In otherwords, if you want values of 16.5 to round to the next larger integer, 17 and values less than 16.5 to round to the next smaller integer (16), then you can just use the round function:
Round ( 16.75 ; 0 ) ---> 17
Round ( 16.49 ; 0 ) ---> 16
If I was working with just a number field, but the 16.75 is a result of a calculation.
(total rounds of widgets / 4) returns 16.75 or 19.2...
Do I need a second field to round up or down the numeric result? Or can I somehow extend the calculation to do that?
Excellent - thank you
If you want 16.x to always go to 17 use the ceiling function.
ceiling(16.01) = 17
Be aware of the different situations where you want the calculation to round verses wanting a field in a layout to display rounded numbers. It could be that you want to retain the full decimal accuracy, but only display it rounded. In the inspector under the data tab at the bottom you can format number fields to be decimal so that you can set it to round to 0 for whole numbers. That way you display it rounded, but you don't change the underlying result. Just note that the layout formatting will effect how things display regardless of the value as calculated or typed, but does not change the actual number.
The basic rule for whether you round the value or round the display is "will this value be used in subsequent calculations"? Most of the time (not always), you want to keep all values unrounded until you compute the final result so you would round the display of any intermediary values if you need to show them, but use the unrounded value for additional calculations.
The common exception to the above is when the intermediary value represents currency that has to be used in a financial transaction. Then you sometimes have no choice but to round intermediary values--say it's a calculated loan payment where the customer can't make payments in fractions of a penny..., and have to take other steps to adjust for the accumulated round off error--such as adjusting the final loan payment up or down by a small amount so that the total payments exactly equals the total loan.
All good advice. Found out it works in a variety of software.
My application was simple figuring out portions for a Chef with out having to calculate 7/8 of a turkey.
Thank you all.
Retrieving data ...