FlexCeiling ( number ; precision )
An expanded "Ceiling" that accepts a precision argument
Average rating: 4.1 (37 votes) Log in to vote
Kevin Frank - Show more from this author
Kevin Frank & Associates https://filemakerhacks.com |
FlexCeiling( 123.341 ; -2)
FlexCeiling( 123.341 ; -1)
FlexCeiling( 123.341 ; 0)
FlexCeiling( 123.341 ; 1)
FlexCeiling( 123.341 ; 2)
FlexCeiling( 123.341 ; 3)
200
130
124
123.4
123.35
123.341
Function definition: (Copy & paste into FileMaker's Edit Custom Function window)
While the Ceiling function by definition returns the smallest integer >= x, I found myself wishing it could accept a precision argument the way Round does. The FlexCeiling custom function allows this to happen.
Essentially, FlexCeiling is a "magic Round" that always makes a number larger -- regardless of whether that number is positive or negative -- whereas Rounding (via the Round function) a negative number "up" actually makes it smaller (more negative).
E.g., Round ( -4.7 ; 0 ) = -5 whereas FlexCeiling ( -4.7 ; 0 ) = -4
Note: see also the companion custom function, FlexFloor.
Comments
Note: these functions are not guaranteed or supported by BrianDunning.com. Please contact the individual developer with any questions or problems.