Fun.Think.Wonder - Mabzicle

HOW TO: Convert Numbers(Currency) Into English Words In Excel

Microsoft Excel is a great spreadsheet software program for computing and sorting out data. But has a limitation...

Microsoft Excel is an excellent spreadsheet software program for computing and sorting out data. Well, it is roughly designed to process large data arrays after its predecessor —  VisiCalc. 

Short history: In 1928, a Harvard Business school student, Daniel, Bricklin has this idea for a visible calculator. Later, Bricklin and Bob Frankston created the so-called "First Killer" application for PC; that is VisiCalc.  


HOW TO: Convert Numbers(Currency) Into English Words In Excel

Microsoft Excel indeed solves the accounting records problem. Thus, it's quite one of the best tools among users including me. 

But there is a limitation with this powerful program, sometimes, we need to convert number currency (Peso, Dollar, Euros, GPC, pounds, etc.) to English Words, and doesn't have this built-in function.

Examples: 
  • 123 to "one hundred and twenty-three."
  • $123 to "one hundred and twenty-three dollars."
  • $123.50 to "one hundred and twenty-three dollars and fifty cents."
  • Php 123.00 to "one hundred and twenty-three pesos."
  • Php 123.50 to "one hundred and twenty-three pesos and fifty centavos."
However, the good thing is, they made a function module. (found on https://support.office.com/en-us/article/Convert-numbers-into-words-a0d166fb-e1ea-4090-95c8-69442cd55d98) Honestly, it gives me a great deal with it. I don't need to reinvent the wheel (create from scratch).

Here it goes:

HOW TO: Convert Numbers(Currency) Into English Words In Excel

1. Open Microsoft Excel
2. Press ALT+F11 on your keyboard to open the Microsoft Visual Basic window.
3. Then, Choose the Insert menu then click Module
4. Copy the following code and paste it on that module window

Option Explicit
'Main Function
Function SpellNumber(ByVal MyNumber)
    Dim Dollars, Cents, Temp
    Dim DecimalPlace, Count
    ReDim Place(9) As String
    Place(2) = " Thousand "
    Place(3) = " Million "
    Place(4) = " Billion "
    Place(5) = " Trillion "
    ' String representation of amount.
    MyNumber = Trim(Str(MyNumber))
    ' Position of decimal place 0 if none.
    DecimalPlace = InStr(MyNumber, ".")
    ' Convert cents and set MyNumber to dollar amount.
    If DecimalPlace > 0 Then
        Cents = GetTens(Left(Mid(MyNumber, DecimalPlace + 1) & _
                  "00", 2))
        MyNumber = Trim(Left(MyNumber, DecimalPlace - 1))
    End If
    Count = 1
    Do While MyNumber <> ""
        Temp = GetHundreds(Right(MyNumber, 3))
        If Temp <> "" Then Dollars = Temp & Place(Count) & Dollars
        If Len(MyNumber) > 3 Then
            MyNumber = Left(MyNumber, Len(MyNumber) - 3)
        Else
            MyNumber = ""
        End If
        Count = Count + 1
    Loop
    Select Case Dollars
        Case ""
            Dollars = "No Dollars"
        Case "One"
            Dollars = "One Dollar"
         Case Else
            Dollars = Dollars & " Dollars"
    End Select
    Select Case Cents
        Case ""
            Cents = " and No Cents"
        Case "One"
            Cents = " and One Cent"
              Case Else
            Cents = " and " & Cents & " Cents"
    End Select
    SpellNumber = Dollars & Cents
End Function
      
' Converts a number from 100-999 into text 
Function GetHundreds(ByVal MyNumber)
    Dim Result As String
    If Val(MyNumber) = 0 Then Exit Function
    MyNumber = Right("000" & MyNumber, 3)
    ' Convert the hundreds place.
    If Mid(MyNumber, 1, 1) <> "0" Then
        Result = GetDigit(Mid(MyNumber, 1, 1)) & " Hundred "
    End If
    ' Convert the tens and ones place.
    If Mid(MyNumber, 2, 1) <> "0" Then
        Result = Result & GetTens(Mid(MyNumber, 2))
    Else
        Result = Result & GetDigit(Mid(MyNumber, 3))
    End If
    GetHundreds = Result
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

Take note: the currency is a dollar, therefore, depending on your location, you need to change the text above. The function yields these results:


Notice that if there is no decimal point, it will add "No Cents." In the real world, there is no need to put such words. Ideally, the "only" word shall be put at the last of those sentences.

You can still edit it in the code above.

Tip: No need to manually type over again that function. All you need is to point and drag it down until it displays the result. See below in action.

You will notice that it is not capitalized. If you wish to convert it to ALL UPPER CASE then right thing, Excel has built-in ALL CAPS. Thanks to function UPPER().

5. Then you close that window. In your Excel window, try to type =SpellNumber you will notice if successfully embedded, display the function.

By the way, the function is called SpellNumber(Cell) (try to see the above code)

6. There you have it! After accomplishing the desired output, you need to SAVE it to a macro-enabled format. At first, it will prompt something like this:


As per instruction, you need to save it in a macro-enabled to include the function code. Therefore, click NO, and start choosing a .xlsm file format.


Final Thoughts
If you have comments and suggestions, you may cast them below. Thank you!

Name

Android,2,Art,1,Artist,1,bandwidth,1,Battle Pass,1,Blogging,3,BPO,1,Business,3,Call Center,1,Camera,1,CISCO,1,COMELEC,1,Connectivity,2,CSC,11,CSC Exams,3,Dating,1,Design,3,DITO,1,DIY,1,Dota,1,Dota 2,5,EaseUS,1,Epic Games,3,explained,1,Facebook,6,Facebook Application,1,Featured,3,Featured Post,1,Flagship Phone,1,food,2,Forms,2,Freelance,1,Fruit,1,Gadget,2,Game,17,GCASH,1,Giveaway,3,Globe,1,Globe Telecom,5,Google,2,Google Doodle,1,Health,11,History,1,How TO,24,Huawei,1,Infographic,1,ISP,1,Job Hiring,4,Job Search,1,laws,1,Life Hacks,1,Life Style,1,Lifestyle,7,Logo,1,MC,1,Mid-Range,1,Multimedia,1,Napolcom,1,Networking,1,News,7,Online Job,2,Paper,1,PC Game,1,People,1,PH Government,7,Poster,1,PRC,1,Press Release,1,Productivity,1,Promos,2,Redmi,2,Relationship,1,Research,3,Review,2,Reviewer,2,Science,9,Security,1,SIM,1,Smart,1,Smartphone,4,Software,3,Specs,4,Sponsored,2,Standalone,1,Steam,5,Technology,11,Tekken,1,Tip,9,Tips,2,TM,1,Tool,1,Trivia,1,Tutorial,10,Valve,1,ViVO,1,Warcraft,1,Web,2,Windows,2,Winner,1,Xiaomi,1,Youtube,1,
ltr
item
Mabzicle: HOW TO: Convert Numbers(Currency) Into English Words In Excel
HOW TO: Convert Numbers(Currency) Into English Words In Excel
Microsoft Excel is a great spreadsheet software program for computing and sorting out data. But has a limitation...
https://2.bp.blogspot.com/-B2NbSrQLXEs/Vqwh15iCf3I/AAAAAAAASI8/xMIYQs1QlSg/s640/EXCEL%2BCONVERSION.png
https://2.bp.blogspot.com/-B2NbSrQLXEs/Vqwh15iCf3I/AAAAAAAASI8/xMIYQs1QlSg/s72-c/EXCEL%2BCONVERSION.png
Mabzicle
https://www.mabzicle.com/2016/01/convert-numbers-to-word-in-microsoft-excel.html
https://www.mabzicle.com/
https://www.mabzicle.com/
https://www.mabzicle.com/2016/01/convert-numbers-to-word-in-microsoft-excel.html
false
219040821802169216
UTF-8
Loaded All Posts Not found any posts VIEW ALL Readmore Reply Cancel reply Delete By Home PAGES POSTS View All RECOMMENDED FOR YOU LABEL ARCHIVE SEARCH ALL POSTS Not found any post match with your request Back Home Sunday Monday Tuesday Wednesday Thursday Friday Saturday Sun Mon Tue Wed Thu Fri Sat January February March April May June July August September October November December Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec just now 1 minute ago $$1$$ minutes ago 1 hour ago $$1$$ hours ago Yesterday $$1$$ days ago $$1$$ weeks ago more than 5 weeks ago Followers Follow THIS PREMIUM CONTENT IS LOCKED STEP 1: Share to a social network STEP 2: Click the link on your social network Copy All Code Select All Code All codes were copied to your clipboard Can not copy the codes / texts, please press [CTRL]+[C] (or CMD+C with Mac) to copy Table of Content