Brian Dunning's FileMaker Custom Functions

fnNumberFormat ( number ; decimals ; dec_point ; thousands_sep )

This CF simply emulates PHP's number_format() function using identical parameters (

  Average rating: 4.0 (54 votes) Log in to vote

Andrew Butt   Andrew Butt

Share on Facebook Share on Twitter

  Sample input:
fnNumberFormat ( 12345678.9012 ; 2 ; "." ; "," )
  Sample output:

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

This CF simply emulates PHP's number_format() function using identical parameters (



Bruce Robertson   Bruce Robertson
May 8, 2009
What does "all rights reserved" mean in a custom function intentionally made available for copying in a custom function sharing site?
Drew Wesley   Drew Wesley, Los Angeles, CA
May 9, 2009
Hi Bruce,

Quite honestly, I paste this tag on all of my created CFs. Seeing that the phrase has become obsolete as of 2000, I'm removing it. However, these 'reserved rights' are what allow us to freely distribute our CFs in the first place! :)
Matthias Wuttke   Matthias Wuttke, Eschlikon TG
Oct 14, 2009
Hi all

I have a small add to this Function:
If I choose 0 Decimals, then I don't like for Example 35'000.
I would like to have 35'000
without a Point on the End....
Here the Solution: (only the last couple Lines
Case (
// No parameters specified...
decimals = "" AND dec_point = "" AND thousands_sep = "" ;
number ;
// No decimal requested
decimals = 0;
// Else
dollars & dec_point & cents
Anyhow Bruce Thanks for this great Function!
Drew Wesley   Drew Wesley, Los Angeles, CA
Oct 16, 2009
Hi Matthias,

I implemented your good suggestion and made another improvement to include negative decimals - similar to the way the Round ( ) function works.
Vincent   Vincent, France
Feb 11, 2011

This doesn't work with non english langauges, at least those whose native decimal separateor are not .

Your code assumes that the number have their decimal separator as a dot. If you use Filemaker on a french OS, then FMP internal decimal separator wil be the comma.

So you have to avoid this assumption in your code.

Moreover an option to avoir 129,00 when the nulber is just 129 would be nice

Jon Rosen   Jon Rosen, Pembroke Pines, FL
Jan 24, 2012
Just a warning not to use this function with numbers containing leading zeros (typically stored as a text field). This function will strip leading zeros from those numbers.
Peter Wagemans   Peter Wagemans, Lesterius
Jul 20, 2019
middle ( pi ; 2 ; 1 ) is a good way to get the decimal separator.

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: