Brian Dunning's FileMaker Custom Functions

FlexCeiling ( number ; precision )

An expanded "Ceiling" that accepts a precision argument

  Average rating: 4.1 (37 votes) Log in to vote

Kevin Frank   Kevin Frank
Kevin Frank & Associates
http://www.kevinfrank.com

Share on Facebook Share on Twitter

  Sample input:
FlexCeiling( 123.341 ; -3)
FlexCeiling( 123.341 ; -2)
FlexCeiling( 123.341 ; -1)
FlexCeiling( 123.341 ; 0)
FlexCeiling( 123.341 ; 1)
FlexCeiling( 123.341 ; 2)
FlexCeiling( 123.341 ; 3)
  Sample output:
1000
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

Log in to post comments.

 

Note: these functions are not guaranteed or supported by BrianDunning.com. Please contact the individual developer with any questions or problems.

Support this website.

This library has been a free commmunity resource for FileMaker users and developers for 15 years. It receives no funding and has no advertisements. If it has helped you out, I'd really appreciate it if you could contribute whatever you think it's worth:

Under construction. Email me your wish list for improvements.