Skip to content

Get the NumSuffix(English)

Function OrdinalSuffix(ByVal Num As Long) As String
Dim n As Long
Const cSfx = “stndrdthththththth” ‘ 2 char suffixes
n = Num Mod 100
If ((Abs(n) >= 10) And (Abs(n) <= 19)) _ Or ((Abs(n) Mod 10) = 0) Then OrdinalSuffix = "th" Else OrdinalSuffix = Mid(cSfx, _ ((Abs(n) Mod 10) * 2) - 1, 2) End If End Function Function NumSuffix(MyNum As Variant) As String '******************************************* 'Purpose: Add suffix to a number 'Inputs: ? NumSuffix(234) 'Output: 234th '******************************************* Dim n As Integer Dim x As Integer Dim strSuf As String n = Right(MyNum, 2) x = n Mod 10 strSuf = Switch(n <> 11 And x = 1, “st”, n <> 12 And x = 2, “nd”, _
n <> 13 And x = 3, “rd”, True, “th”)
NumSuffix = LTrim(Str(MyNum)) & strSuf

End Function

Public Function DateSay(ByRef pDte As Date) As String
Dim strHold As String

strHold = NumSuffix(Day(pDte)) & ” ” & Format(pDte, “mmmm”) & ” ” & Format(pDte, “yyyy”) & ” (” & Format(pDte, “ddd”) & “)”
DateSay = strHold

End Function