Ordinal ( number )
Converts an integer into an ordinal number (1st, 2nd, 3rd).
Average rating: 3.8 (45 votes) Log in to vote
Vaughan Bromfield - Show more from this author |
Function definition: (Copy & paste into FileMaker's Edit Custom Function window)
Based on a discussion held on FM Forums.
Contributions by Bob Weaver, LaRetta, and Vaughan Bromfield.
This function returns the number appended with the ordinal text.
Let(
[
d = Int( GetAsNumber( number ) ) ;
n = Mod ( Abs( d ) ; 100 )
] ;
d & Choose ( Min( 4 ; Mod( n ; 10 ) ) * ( ( n < 11 ) or ( n > 13 ) ) ; "th" ; "st" ; "nd" ; "rd" ; "th" )
)
Comments
Simon Jenkins, Llanwrda Mar 20, 2018 |
||
Guys - Hi, brilliant script - thank you. However, when I come to export an excel sheet, the export cuts off the ordinal, ie : 1st just appears as 1 in excel, 28th as 28 etc. Am I missing something to allow the ordinal part to be exported to excel? Many thanks |
||
Vaughan Bromfield Mar 21, 2018 |
||
That's Excel modifying the data, nothing to do with FileMaker. To confirm, open the exported data (csv or whatever) in a text editor (NOT Excel). |
||
Note: these functions are not guaranteed or supported by BrianDunning.com. Please contact the individual developer with any questions or problems.