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 - Show more from this author
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, Monk Media
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.

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: