Brian Dunning's FileMaker Custom Functions

NextRoundNumber ( number )

Shows the next highest "round" number

  Average rating: 4.2 (27 votes) Log in to vote

Joe Rovang   Joe Rovang - Show more from this author

Share on Facebook Share on Twitter

  Sample input:
NextRoundNumber ( 42 )
  Sample output:
50

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

This function finds the next highest "round" number, based on whatever factor of ten the original number is based. For instance, 11 becomes 20; 200 becomes 300; 0.4 becomes 0.5; and -120 becomes -100. (In this function, a "round" number is regarded as an integer multiplied by some power of ten.)

This function might be useful for determining a chart's maximum scale (as in xmCHART): for example, if the maximum data point is 428, this function returns 500 as an appropriate chart maximum. It bumps already round numbers up (200 goes to 300), on the principle that a chart's data point should never lie directly on the maximum. (An exception is made for zero.)

 

Comments

James   James, Northwest Enforcement
Sep 12, 2009
This works well with number less than 100,000. If you have number say 101,000, the next round number return by this function is 200,000 which it way too large. The xmCHART does not looks good with this large maximum value
 

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 20 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: