Convert Numbers to Words in Excel(Step-by-Step VBA Code)

Rate this post

🔢 Convert Numbers to Words in Excel: Step-by-Step VBA Guide (with Code)

Converting numeric values into readable text format is often necessary for financial reports, invoicing, or official documents. If you’re wondering how to convert numbers to words in Excel, this tutorial will guide you through a simple and effective VBA method to automate the task.

In this article, you’ll learn how to:

  • Use VBA to convert numbers into text
  • Implement the custom formula in Excel
  • Understand where and why this feature is useful

✅ This guide includes complete VBA code, screenshots, use cases, FAQs, and everything you need to start using it today!



📌 Why Convert Numbers to Words in Excel?

There are many practical scenarios where you need to convert numbers to words in Excel:

  • Writing amount in words for cheques or invoices
  • Financial reporting formats
  • Payroll statements
  • Automating documents like tax forms

Excel doesn’t offer a built-in function to do this, but with a simple VBA macro, you can get it done in seconds.


🧩 How to Convert Numbers to Words in Excel (Step-by-Step)

Here’s a simple step-by-step tutorial to help you convert numbers to words in Excel using a VBA macro.

✅ Step 1: Open the VBA Editor

  • Press Alt + F11 on your keyboard.
  • This will open the Visual Basic for Applications (VBA) editor.

✅ Step 2: Insert a Module

  • Click on Insert > Module from the top menu.
  • A blank module will appear on the screen.

✅ Step 3: Paste the VBA Code

Copy and paste the below code into the module:

Function NumberToWords(ByVal MyNumber)
Dim Units As String
Dim SubUnits As String
Dim TempStr As String
Dim DecimalPlace As Integer
Dim Count As Integer
Dim DecimalSeparator As String
DecimalSeparator = "."

ReDim Place(9) As String
Place(2) = " Thousand "
Place(3) = " Million "
Place(4) = " Billion "

' Convert MyNumber to string and handle decimal
MyNumber = Trim(Str(MyNumber))
DecimalPlace = InStr(MyNumber, DecimalSeparator)

If DecimalPlace > 0 Then
Units = Left(MyNumber, DecimalPlace - 1)
SubUnits = Mid(MyNumber, DecimalPlace + 1)
Else
Units = MyNumber
SubUnits = ""
End If

Count = 1
Do While Units <> ""
TempStr = GetHundreds(Right(Units, 3))
If TempStr <> "" Then NumberToWords = TempStr & Place(Count) & NumberToWords
If Len(Units) > 3 Then
Units = Left(Units, Len(Units) - 3)
Else
Units = ""
End If
Count = Count + 1
Loop

NumberToWords = Application.Trim(NumberToWords)
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))
End If

GetHundreds = Result
End Function

Function GetTens(TensText)
Dim Result As String
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

✅ Step 4: Save and Close the Editor

  • Press Ctrl + S to save.
  • Close the VBA window.

✅ Step 5: Use the Custom Formula

In your Excel worksheet, use the formula:

excelCopyEdit=NumberToWords(A1)

It will convert the number in cell A1 into words!


 Want To Learn With Video?


📊 Example Output

Numeric ValueOutput in Words
1500One Thousand Five Hundred
987654Nine Hundred Eighty Seven Thousand Six Hundred Fifty Four
100One Hundred

📎 Where to Use This VBA Function?

  • ✅ Invoice Automation
  • ✅ Accounting Templates
  • ✅ Payslip Formatting
  • ✅ Cheque Printing Sheets

Knowing how to convert numbers to words in Excel saves time and improves document presentation.


📌 Tips for Better Results

  • Always format the number cell as General or Number.
  • Avoid currency symbols (₹, $, etc.) within the input cell.
  • You can modify the function to support currency (like “Rupees” or “Dollars”) with a small change.

🔹 Common Errors & Fixes

❌ “Compile Error: Expected End Sub” → Ensure all End Function statements are present.
❌ Macros Not Enabled → Go to File > Options > Trust Center > Enable Macros.
❌ #NAME? Error → Save the file as .xlsm (macro-enabled workbook).


🔹 Alternative Methods (Without VBA)

If you can’t use VBA, try:
📌 SpellNumber Add-in (Microsoft Office Store)
📌 Online Converters (Paste values into a web tool)


🔹 (FAQ) – Convert Numbers to Words in Excel

How to Convert Numbers to Words in Excel Using Formula?

Excel doesn’t have a built-in formula for this, but you can use VBA (Macros) to create a custom function like =NumberToWords(A1). Follow our step-by-step VBA guide for implementation.

What’s the Formula to Convert Number to Words in Excel 2016?

There’s no direct formula, but you can use VBA in Excel 2016. Alternatively, try:
Third-party add-ins (like SpellNumber)
Power Query (for advanced users)

How Do I Convert Numbers to Words in Excel Automatically?

Use a VBA script (as shown in our guide) or an Excel add-in to auto-convert numbers when entered.

How to Convert Numbers to Words in Excel for Rupees (Indian Currency)?

Modify the VBA code to include “Rupees” and “Paise” instead of dollars/cents. Example:
If SubUnits <> “” Then NumberToWords = NumberToWords & ” Rupees and ” & GetTens(SubUnits) & ” Paise”

What’s the Formula to Convert Number to Words in Excel 2007?

Excel 2007 also requires VBA since there’s no native function. The same code works across Excel 2007-2024.

Where Can I Download a Number-to-Words Converter for Excel?

You can:
✅ Use our free VBA script from this guide
✅ Download SpellNumber Add-in (Microsoft Office Store)

How to Convert Numbers to Words in Excel 2010 & 2013?

The VBA method remains the same for Excel 2010, 2013, and later versions. No version-specific changes are needed.

How to Convert All Numbers to Text in Excel?

Use TEXT() function (e.g., =TEXT(A1,"0"))
Press Ctrl+1 > Format Cells > “Text” before entering numbers

How Do I Replace Numbers with Words in Excel?

Find & Replace (Ctrl+H) – Replace digits manually (limited use)
VBA Automation – Best for bulk conversion

How Do I Convert Excel Data to Words?

For numbers to words, use VBA.
For exporting Excel to Word, use:
Copy-paste special (Keep Text Only)
Mail Merge (for structured data)

🔹 Conclusion

Now you know how to convert numbers to words in Excel using VBA! This trick is perfect for financial reports, invoices, and legal documents.

📥 Download the Ready-to-Use VBA Script Here

🔗 Related Articles:

🛠️ External Resources:

Sharing Is Caring:

Leave a Comment