NumberEnding

Add st, nd, rd or th to end of number, can be used for dates also

CodeFunctionName
What is this?

Public

Tested

Imported
Function NumberEnding(TheNumber)
    ' Add st, nd, rd or th to end of number, can be used for dates also
    ' If you want to automatically insert st,nd,rd or th to the date like Ist, 2nd, 3rd etc then use the following example to achieve
    ' Example:
    ' Input: NumberEnding(22)
    ' Output: 22nd
    ' Oreginally from ...
    ' https://www.vbausefulcodes.com/vbausefulcodes/47/add-st-nd-rd-and-th-to-date
    Ext                        = "th"
    Select Case Right(TheNumber, 1)
    Case 1
        Ext                    = "st"
    Case 2
        Ext                    = "nd"
    Case 3
        Ext                    = "rd"
    End Select
    NumberEnding = TheNumber & Ext
End Function

TheNumber

Views 89

Downloads 48

CodeID
DB ID