Brian Dunning's FileMaker Custom Functions

RoundToSigFigs ( number ; sigfigs )

Rounds a number to the specified number of significant figures.

  Average rating: 4.7 (31 votes) Log in to vote

Ryan Brandys   Ryan Brandys - Show more from this author
Branmuffin Industries

Share on Facebook Share on Twitter

  Sample input:
1234 ; 1
1234 ; 2
1234 ; 3
0.0009876 ; 1
0.0009876 ; 2
0.0009876 ; 3
  Sample output:

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

Rounds a number to the specified number of significant figures. Uses a log base ten to gauge the order of magnitude for "number" and uses that to figure out which decimal place is the rounding point. Then it uses filemaker's built in rounding function to round to that point. For > .5, this function rounds up.



Henry Olders   Henry Olders, Montreal
Dec 1, 2015
because the log function only works with positive numbers, use

Round ( number ; sigfigs - 1 - Floor ( Log ( Abs ( number ) ) ) )
Scott Merry   Scott Merry, EnerG2 Technologies, Inc. - a brand of BASF
Jun 19, 2019
Henry and Ryan,
This is great! However in cases like input number of 0.500000 and you specify 3 sigfigs, the result is 0.5, not 0.500 as is correct.
Have either of you modified the function so that the result would actually be 0.500?

Log in to post comments.


Note: these functions are not guaranteed or supported by 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 16 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: