Brian Dunning's FileMaker Custom Functions

FixExcelImport ( value )

Cleanup imported numbers from Excel, suffering from rounding issues

  Average rating: 3.0 (2 votes) Log in to vote

Richard Dyce   Richard Dyce - Show more from this author
Dyce & Sons Ltd.
http://dyce.com

Share on Facebook Share on Twitter

  Sample input:
FixExcelImport ( 497.69400000000002 )

FixExcelImport ( 296.64999999999998 )

FixExcelImport ( "296.6499.99998" )
  Sample output:
497.694

296.65

296.6499.99998

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

When importing data from Excel, data which could be interpreted as numeric in Excel may sometimes be imported with excessive decimals, due to the way Excel stores numbers. This is a quick & dirty fix for this. Add a call to

FixExcelImport ( Self)

in the field definition for any field you're importing into, and it should be cleaned-up.

The rounding (11) and length checks (5) can of course be changed to suit. :-)

 

Comments

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: