Excel does not have a built-in function to convert numeric values (like 125) into written words (like "One Hundred Twenty Five"). To achieve this, you must create a Custom Function using Visual Basic for Applications (VBA). Once this code is added to your workbook, you can use a formula like =SpellNumber(A1) just as you would with any other standard Excel function.

What You'll Need

  • A desktop version of Microsoft Excel (Excel for Web does not support VBA macros).
  • A workbook saved in the .xlsm (Excel Macro-Enabled Workbook) format.
  • Basic access to the Developer tab or the Alt+F11 shortcut.
  • A numeric value in a cell that you wish to convert.

Step-by-Step

  1. Open the Visual Basic Editor: Open your Excel workbook. Press Alt + F11 on your keyboard. This keyboard shortcut opens the VBA Editor window, which is a separate environment from the standard spreadsheet grid.
  2. Insert a New Module: In the VBA Editor, look at the top menu bar. Click on Insert and then select Module. This creates a blank white page where you can paste the custom code. It is important to put the code in a Module rather than a Sheet or ThisWorkbook object so that the function is available globally across all sheets in that file.
  3. Paste the SpellNumber Code: Copy the following VBA code and paste it into the blank module window. (Note: Since this is a complex script, ensure you copy every line from the start of the function to the end of the module).
    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 " 
        MyNumber = Trim(Str(MyNumber)) 
        DecimalPlace = InStr(MyNumber, ".") 
        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 Exit Do 
            MyNumber = Left(MyNumber, Len(MyNumber) - 3) 
            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 = "No Cents" 
            Case "One" 
                Cents = "One Cent" 
            Case Else 
                Cents = Cents & " Cents" 
        End Select 
        SpellNumber = Dollars & " and " & Cents 
        End Function 
        
        Function GetHundreds(ByVal MyNumber) 
        Dim Result As String 
        If Val(MyNumber) = 0 Then Exit Function 
        MyNumber = Right("000" & MyNumber, 3) 
        If Mid(MyNumber, 1, 1) != "0" Then 
            Result = GetDigit(Mid(MyNumber, 1, 1)) & " Hundred " 
        End If 
        If Mid(MyNumber, 2, 1) != "0" Then 
            Result = Result & GetTens(Mid(MyNumber, 2)) 
        Else 
            Result = Result & GetDigit(Mid(MyNumber, 3, 1)) 
        End If 
        GetHundreds = Result 
        End Function 
        
        Function GetTens(TensText) 
        Dim Result As String 
        Result = "" 
        If Val(Left(TensText, 1)) = 1 Then 
            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 
            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)) 
        End If 
        GetTens = Result 
        End Function 
        
        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
  4. Save and Close the Editor: Press Ctrl + S to save the code, then click the X in the top right corner of the VBA window to return to your Excel spreadsheet.
  5. Apply the Formula: Click on the cell where you want the words to appear. Type =SpellNumber(A1) (assuming your number is in cell A1) and press Enter. The number will now be converted to text.
  6. Save as Macro-Enabled Workbook: This is the most critical step. Go to File > Save As. In the file type dropdown menu, select Excel Macro-Enabled Workbook (*.xlsm). If you save it as a standard .xlsx file, the code will be deleted, and the formula will return a #NAME? error the next time you open the file.

Common Mistakes

One of the most frequent errors is saving the file in the default .xlsx format. Standard workbooks cannot store VBA scripts. When you save as .xlsx, Excel strips out all macros to ensure security, meaning your custom SpellNumber function vanishes instantly. Always check the file extension in the title bar.

Another common mistake is pasting the code into the "ThisWorkbook" or "Sheet1" objects instead of a Module. While some code can run in sheet objects, custom functions designed to be used as formulas in cells must reside in a standard Module to be recognized by the Excel calculation engine across the entire workbook.

Users also frequently forget to enable macros when reopening the file. Because macros can be used to deliver malware, Excel disables them by default. If you see a yellow "Security Warning" bar at the top of your screen saying "Macros have been disabled," you must click Enable Content for the formula to work.

Tips

To make the output look more professional for invoices, you can combine the SpellNumber function with other text. For example, use the formula ="The total amount is " & SpellNumber(A1). This creates a full sentence rather than just the converted amount.

If you need to change the currency from "Dollars" and "Cents" to "Pounds" and "Pence" or "Euros" and "Cents," you can do this easily within the VBA editor. Use Ctrl + H (Find and Replace) inside the module. Search for "Dollar" and replace it with your desired currency. This allows you to localize the function for different regions without rewriting the logic.

For those who need this function in every single workbook they create, consider saving the code in the "Personal Macro Workbook" (Personal.xlsb). This is a hidden workbook that opens every time you start Excel, making your custom functions available globally without having to paste the code into every new file.

Troubleshooting

If the formula returns a #NAME? error, it means Excel does not recognize the function. First, check if you are in a .xlsm file. Second, go back to the VBA editor (Alt+F11) and ensure the code is located in a Module (e.g., Module1) and not inside a Sheet object. Finally, check for typos in the formula; it must exactly match the function name SpellNumber.

If the formula returns a #VALUE! error, it usually means the cell you are referencing contains text or a symbol (like a currency sign $) that Excel is treating as a string rather than a number. Ensure the source cell is formatted as a "Number" or "General" and does not contain manual text entries.

If the results are mathematically incorrect (e.g., it says "Ten" instead of "Eleven"), double-check that the code was copied in its entirety. Missing a single End If or End Function statement will cause the script to fail or produce unpredictable results. The safest fix is to delete the module and paste the code again from a clean source.

Frequently Asked Questions

Does this work on Excel for Mac?

Yes, VBA is supported on Excel for Mac, though the keyboard shortcuts may differ (use the Tools menu to access the Macro editor). The code itself remains compatible.

Can I use this in Google Sheets?

No. Google Sheets uses Apps Script (JavaScript), not VBA. You would need a completely different script written in JavaScript to achieve this in Google Sheets.

Will this work in Excel Online/Web?

No. The web version of Excel cannot execute VBA macros. You must open the file in the desktop application to use the converter.

Is it safe to use VBA code from the internet?

Generally, yes, provided the code is a simple function like this one. However, always review code for "Auto_Open" or "Shell" commands, which can execute system-level changes. This specific SpellNumber script only performs text manipulation.

Can I convert very large numbers?

The provided code supports up to Trillions. If you need to convert numbers in the quadrillions or higher, you would need to expand the Place() array in the VBA code to include larger denominations.