Brian Dunning's FileMaker Custom Functions

FormatThousands ( Number ; Precision ; Separator )

Formats a number separating the thousands by a user specified character.

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

Rob Poelking   Rob Poelking
Excelisys, Inc.
http://excelisys.com

Share on Facebook Share on Twitter

  Sample input:
FormatThousands ( 12345678.9012345678 ; 3 ; " " )
  Sample output:
12 345 678.901

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

Formats any real number separating the thousands position by a user specified character and also specifies the precision of digits after a decimal.

 

Comments

Gary Amstutz   Gary Amstutz, Sweetwater
Feb 9, 2016
This function works great, but it won't work with negative numbers properly.

Try changing the fifth line to:
neg = If ( GetAsNumber ( number ) < 0; "-"; "") ;
and that should fix it.

If you need a function that doesn't force the result to a fixed length decimal number, try FormatThousands (textNum) found at https://www.briandunning.com/cf/1853
 
Rob   Rob, Cleveland, OH
Feb 10, 2016
Thanks Gary, I wrote that some time ago and honestly can't remember why I wrote it that way.
 

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.

Under construction. Email me your wish list for improvements.