Brian Dunning's FileMaker Custom Functions

Fraction ( number )

Returns a number as fraction text.

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

Theo Ros   Theo Ros - Show more from this author

Share on Facebook Share on Twitter

  Sample input:
Fraction ( 5.54 )
  Sample output:
"5 27/50"

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

Returns the number as fraction.
i.e. Fraction ( 5,54 ) --> "5 27/50"

( above uses Dutch syntax ( decimal COMMA's) )

Return type: Text

Uses GCF() function by Scott Morrison

 

Comments

Don Rossi   Don Rossi, Lancaster, PA
Apr 26, 2011
This function is incorrect for decimals less than ".1". Try .0625. The significant zero is purged. It should be:
d = 10 ^ (Length (b) - 2)

I think
 
Thomas Bilski   Thomas Bilski, Antidote Solutions
Sep 11, 2018
I tested Don's edit and it works. The function above does not work properly with .0625.
 

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: