Get the Ordinal of a number
Ivan F Moala
Can Do
Visits here
Goto Guest book sign in page [Home]
Greatest place to be
Thanks for visiting my site lucky visitor:
This page was last updated on: April 25, 2006
Copyright © 2002. XcelFiles. All Rights Reserved Ivan F Moala
Tell a friend about this page
Google
Search WWW Search My Site!

Here is a User Defined Function (UDF) that gets the ordinal of a number -  an ordinal number is an adjective which describes the numerical position of an object, e.g., first, second, third, etc.
If you have found this file useful then consider donating. Why Donate ?
Public Function fnGetOrdinal(cuNumber As Currency) As String
'// In common usage, an ordinal number is an adjective which describes the
'// numerical position of an object, e.g., first, second, third, etc.
    '// For +ve & -ve numbers
    Dim strOut As String * 2
    Dim strDg As String
    
    '// For WorkSheet Calculation
    Application.Volatile
    
    If Abs(cuNumber) >= 4 And Abs(cuNumber) <= 20 Or (Abs(cuNumber) Mod 10) = 0 Then
        strDg = " th"
    Else
        strDg = Application.WorksheetFunction.Choose(Abs(cuNumber) Mod 10, _
            " st", " nd", " rd", " th", " th", " th", " th", " th", " th")
    End If
    
    fnGetOrdinal = cuNumber & strDg
    
End Function
Download example workbook