Brian Dunning's FileMaker Custom Functions

RoundToMultiple ( number ; precision )

Round a number to the nearest multiple of a given precision

  Average rating: 4.4 (35 votes) Log in to vote

Menno van Beek   Menno van Beek - Show more from this author
Van Beek Zakelijke Software
https://www.vbzs.nl

Share on Facebook Share on Twitter

  Sample input:
RoundToMultiple ( 1.71 , 0.5 )
RoundToMultiple ( 1.78 , 2 )
  Sample output:
1.5
2

  Function definition: (Copy & paste into FileMaker's Edit Custom Function window)

Round a number to the nearest multiple of a given precision.
The precision may not equal zero. A negative or positive precision gives the same result.

The result of this function is similar to bankersrounding, except that you can choose any precision:
RoundToMultiple ( 1.045 ; 0.02 ) <=> 1.04
RoundToMultiple ( 1.055 ; 0.02 ) <=> 1.06

 

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: