This guide shows you how to convert numeric values into their word equivalents using VBA in Microsoft Excel, enabling automated text representation of numbers for checks, invoices, or reports.

What You'll Need

  • Microsoft Excel (any recent version supporting VBA, such as 2016, 2019, 2021, or Microsoft 365)
  • Basic familiarity with opening the VBA editor (Alt+F11)
  • A workbook where you want to implement the number-to-word conversion

Step-by-Step

  1. Open your Excel workbook and press Alt + F11 to launch the VBA Editor.
  2. In the VBA Editor, go to the Insert menu and select Module to create a new module.
  3. Copy and paste the following complete VBA function into the module window:
  4. Function NumberToWords(ByVal MyNumber)
        Dim Units As Variant, Tens As Variant
        Dim StartNum As String, Result As String, DecimalPart As String
        Dim DecimalPlace As Integer, Count As Integer
    
        Units = Array("", "One", "Two", "Three", "Four", "Five", "Six", "Seven", "Eight", "Nine")
        Tens = Array("", "Ten", "Twenty", "Thirty", "Forty", "Fifty", "Sixty", "Seventy", "Eighty", "Ninety")
    
        MyNumber = Trim(Str(MyNumber))
        DecimalPlace = InStr(MyNumber, ".")
        If DecimalPlace > 0 Then
            DecimalPart = " point " & Mid(MyNumber, DecimalPlace + 1)
            MyNumber = Left(MyNumber, DecimalPlace - 1)
        End If
    
        StartNum = Right("000" & MyNumber, 3)
        Count = 1
        Do While StartNum <> "000"
            Result = ConvertHundreds(StartNum) & Choose(Count, " Thousand ", " Million ", " Billion ", " ") & Result
            StartNum = Right("000" & Left(MyNumber, Len(MyNumber) - 3 * Count), 3)
            Count = Count + 1
        Loop
    
        NumberToWords = Trim(Result) & DecimalPart
        If NumberToWords = "" Then NumberToWords = "Zero"
    End Function
    
    Private Function ConvertHundreds(ByVal HNum)
        Dim Result As String
        If Val(HNum) = 0 Then Exit Function
        HNum = Right("000" & HNum, 3)
        If Mid(HNum, 1, 1) <> "0" Then
            Result = Units(Val(Mid(HNum, 1, 1))) & " Hundred "
        End If
        If Mid(HNum, 2, 1) <> "0" Then
            Result = Result & Tens(Val(Mid(HNum, 2, 1)))
            If Mid(HNum, 3, 1) <> "0" Then Result = Result & "-"
        ElseIf Mid(HNum, 3, 1) <> "0" Then
            Result = Result & Units(Val(Mid(HNum, 3, 1)))
        End If
        ConvertHundreds = Trim(Result)
    End Function
  5. Close the VBA Editor and return to your Excel worksheet.
  6. In any cell, use the function like a regular formula: =NumberToWords(A1) where A1 contains the number you want to convert (e.g., 123.45).
  7. The function will return the number in words, such as "One Hundred Twenty Three point Four Five".
  8. To use this function across multiple sheets or workbooks, save the file as a Macro-Enabled Workbook (.xlsm).

Common Mistakes

  • Forgetting to save the workbook as a macro-enabled file (.xlsm), which causes the VBA code to be lost when closing.
  • Passing non-numeric values (like text or errors) to the function, resulting in a #VALUE! error.
  • Misplacing the decimal logic, leading to incorrect handling of cents or fractional parts (e.g., treating 0.50 as "Five" instead of "point Five Zero").
  • Not trimming input values, causing extra spaces to interfere with number parsing.
  • Using the function in a protected sheet without enabling macros, which blocks execution.

Tips

  • Test the function with known values like 0, 1, 10, 19, 20, 99, 100, 101, 1000, 1234.56 to verify correct output.
  • For currency use, wrap the result: ="Dollars " & NumberToWords(A1) & " and " & NumberToWords((A1-INT(A1))*100) & " Cents".
  • Add error handling if using in production: wrap the function call in IFERROR(NumberToWords(A1), "Invalid Input").
  • To support other currencies, modify the function to accept a currency parameter or create separate versions.
  • If you need lowercase output, wrap the result in LCASE(NumberToWords(A1)).

Troubleshooting

  1. If the function returns #NAME?, ensure macros are enabled: go to File > Options > Trust Center > Trust Center Settings > Macro Settings and select "Enable all macros" (temporarily for testing) or "Disable all macros with notification" and click "Enable Content" when opening the file.
  2. If the function returns #VALUE!, check that the input cell contains only a number — remove any text, symbols, or spaces.
  3. If the output seems truncated or incorrect for large numbers (over 999 billion), note that the current implementation supports up to billions; extend the Choose array and logic for trillions if needed.
  4. If decimal places show as "point Zero" instead of omitting the decimal, this is by design for clarity; adjust the DecimalPart logic if you prefer to drop .0 values.
  5. If the function works in one workbook but not another, confirm the module was copied correctly and the workbook is saved as .xlsm.

Frequently Asked Questions

Can this function handle negative numbers?

No, the current version does not process negative numbers. To add support, modify the function to check if MyNumber < 0, then prefix "Minus " and work with the absolute value.

How do I convert numbers to words in Indian numbering format (lakhs, crores)?

This function uses the international format (thousands, millions). For Indian format, you would need to adjust the grouping logic to handle two-digit groups after the first three digits (e.g., thousands, then lakhs, then crores).

Why does 0.50 show as "point Five Zero" and not "point Five"?

The function preserves all decimal digits for accuracy. To trim trailing zeros, you would need to process the decimal string separately before conversion.

Can I use this in Access or Word VBA?

Yes, the same VBA code works in Microsoft Access and Word. Simply insert a module in the VBA editor of those applications and use the function similarly.

Is there a limit to the size of number this can convert?

The current implementation handles numbers up to 999,999,999,999 (just under one trillion). Beyond that, the grouping logic would need extension to include trillions and higher.

Do I need to reinstall anything to use this?

No installation is required. The function is self-contained in the VBA module and works as long as macros are enabled and the workbook is macro-enabled.