Brian Dunning's FileMaker Custom Functions

numOrdinalSuffix ( number )

Returns the appropriate ordinal number suffix (-st, -nd, -rd, -th) for a supplied number. Thus, 12 would return a superscript

  Average rating: 4.6 (36 votes) Log in to vote

Jonathan Mickelson   Jonathan Mickelson

Share on Facebook Share on Twitter

  Sample input:
numOrdinalSuffix ( 12 )
numOrdinalSuffix ( 1 )
numOrdinalSuffix ( 23 )
numOrdinalSuffix ( 892 )

numField & numOrdinalSuffix ( numField )

  Sample output:
th (as in 12th)
st (as in 1st)
rd (as in 33rd)
nd (as in 892nd)

24th

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

Returns the correct ordinal suffix (-st, -nd, -rd, -th) for a given number. For example if a supplied parameter "number" is 12, the result is "th". This uses the English ordinal numbering rules for all numbers. Thus, normal use of the function to display the number followed by the Ordinal suffix would use a similar calculation to the following:

numberField & numOrdinalSuffix ( numberField )

Result Type - text (with optional Superscript style ordinal, enabled by default)

Note - To remove the style modification of "Superscript" just remove the value from the variable txtStyle defined below to make it null or "".

 

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.

Under construction. Email me your wish list for improvements.