# mkFormatDollarsWithCommas ( Amount )

Format a number as dollars, separated by commas and truncated to two decimal places. Uses recursion to avoid maximum limit on length of numbers to be formatted.

Average rating: 4.5 (33 votes) Log in to vote

Michael Kupietz - Show more from this author
Michael Kupietz FileMaker Consulting https://michaelkupietz.com |

mkFormatDollarsWithCommas ( -123 )

-$123.00

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

This takes any string of digits, with any number of decimal places and an optional negative sign at the beginning, and returns them as a text string formatted dollar sign, commas every three decimal places before the decimal point, and two decimal places after the point.

The advantage of the recursive method used is that there is no maximum limit on the length of the number which is to be converted.

## Comments

Tim Owen, Los Angeles, CA Dec 3, 2009 |
||

There appears to be an error in the formula in the line: 'If(Digits<0;"-";"")&"$"&' If you replace 'Digits' with 'Number' (the correct parameter), it works. Tim Owen tim@timowenconsulting.com |
||

Note: these functions are not guaranteed or supported by BrianDunning.com. Please contact the individual developer with any questions or problems.