Convert date to the English spelling

Closed
Hassanuddin - Updated on Jun 11, 2018 at 12:06 PM
TrowaD Posts 2921 Registration date Sunday September 12, 2010 Status Moderator Last seen December 27, 2022 - Jun 11, 2018 at 12:05 PM
Hello,
My date of birth
1-3-1995
Please convert to the English spelling



Related:

1 response

TrowaD Posts 2921 Registration date Sunday September 12, 2010 Status Moderator Last seen December 27, 2022 555
Jun 11, 2018 at 12:05 PM
Hi Hassanuddin,

Consider using this adjusted SpellNumber function:
Function NTT(ByVal MyNumber)
Dim Temp

If Len(MyNumber) = 1 Then
    Temp = GetDigit(MyNumber)
    GoTo exitFunction
End If

If Len(MyNumber) > 2 Then
    Temp = GetTens(Left(MyNumber, 2)) & " Hundred "
End If

Temp = Temp & GetTens(Right(MyNumber, 2))

exitFunction:
NTT = Temp
End Function

' Converts a number from 10 to 99 into text.
Function GetTens(TensText)
    Dim Result As String
    Result = ""           ' Null out the temporary function value.
    If Val(Left(TensText, 1)) = 1 Then   ' If value between 10-19...
        Select Case Val(TensText)
            Case 10: Result = "Ten"
            Case 11: Result = "Eleven"
            Case 12: Result = "Twelve"
            Case 13: Result = "Thirteen"
            Case 14: Result = "Fourteen"
            Case 15: Result = "Fifteen"
            Case 16: Result = "Sixteen"
            Case 17: Result = "Seventeen"
            Case 18: Result = "Eighteen"
            Case 19: Result = "Nineteen"
            Case Else
        End Select
    Else                                 ' If value between 20-99...
        Select Case Val(Left(TensText, 1))
            Case 2: Result = "Twenty "
            Case 3: Result = "Thirty "
            Case 4: Result = "Forty "
            Case 5: Result = "Fifty "
            Case 6: Result = "Sixty "
            Case 7: Result = "Seventy "
            Case 8: Result = "Eighty "
            Case 9: Result = "Ninety "
            Case Else
        End Select
        Result = Result & GetDigit _
            (Right(TensText, 1))  ' Retrieve ones place.
    End If
    GetTens = Result
End Function
     
' Converts a number from 1 to 9 into text.
Function GetDigit(Digit)
    Select Case Val(Digit)
        Case 1: GetDigit = "One"
        Case 2: GetDigit = "Two"
        Case 3: GetDigit = "Three"
        Case 4: GetDigit = "Four"
        Case 5: GetDigit = "Five"
        Case 6: GetDigit = "Six"
        Case 7: GetDigit = "Seven"
        Case 8: GetDigit = "Eight"
        Case 9: GetDigit = "Nine"
        Case Else: GetDigit = ""
    End Select
End Function


Then in Excel use the formula:
=ntt(DAG(A1)) & " " & BEGINLETTERS(TEKST(A1;"Mmmm")) & " " &ntt(JAAR(A1))
or if you are using a non dutch version:
=ntt(DAY(A1)) & " " & PROPER(TEXT(A1,"Mmmm")) & " " &ntt(YEAR(A1))


Kom je er zo uit?

Best regards,
Trowa
0