To convert a number to words in Excel, you need a VBA function because Excel has no built-in formula for this. The shortest working route is: open the VBA editor with Alt+F11, insert a new module, paste a conversion function, then call it from a cell like =NumberToWords(A1). The function below handles whole numbers from 0 up to 999,999,999 and returns text such as "One Thousand Two Hundred Thirty-Four".
What You'll Need
- Excel on Windows or Mac with macros enabled (the desktop app, not Excel for the web, which cannot run VBA).
- A workbook saved as
.xlsm(macro-enabled) if you want the code to persist. - Basic familiarity with opening the VBA editor and pasting code.
- Macro security set to allow macros, or the workbook placed in a Trusted Location.
Step-by-Step
- Save the workbook as macro-enabled first. Go to File > Save As and choose Excel Macro-Enabled Workbook (
.xlsm). If you skip this, Excel will warn you on close and your code will be lost. - Open the VBA editor. Press Alt+F11 on Windows, or Fn+Alt+F11 on some Mac keyboards. On Mac you can also use Tools > Macro > Visual Basic Editor from the Excel menu.
- Insert a module. In the editor, choose Insert > Module. A blank code window appears in the right pane. Do not paste into Sheet1 or ThisWorkbook unless you specifically want sheet-level code.
- Paste the conversion function. Copy the code below into the module. It uses three helper arrays for ones, tens and scales, and builds the words from the right side of the number leftward.
Function NumberToWords(ByVal num As Double) As String Dim ones As Variant, tens As Variant, scales As Variant Dim n As Long, part As Long, i As Integer Dim result As String, chunk As String "One", "Two", "Three", "Four", "Five", "Six", "Seven", "Eight", "Nine", _ "Ten", "Eleven", "Twelve", "Thirteen", "Fourteen", "Fifteen", "Sixteen", _ "Seventeen", "Eighteen", "Nineteen") tens = Array("", "", "Twenty", "Thirty", "Forty", "Fifty", "Sixty", "Seventy", "Eighty", "Ninety") scales = Array("", "Thousand", "Million", "Billion") If num = 0 Then NumberToWords = "Zero": Exit Function If num < 0 Then NumberToWords = "Minus " & NumberToWords(-num): Exit Function If num >= 1000000000000# Then NumberToWords = "Number too large": Exit Function n = CLng(Int(num)) i = 0 Do While n > 0 part = n Mod 1000 If part > 0 Then chunk = ConvertChunk(part, ones, tens) If scales(i) <> "" Then chunk = chunk & " " & scales(i) If result <> "" Then result = chunk & " " & result Else result = chunk End If n = n \ 1000 i = i + 1 Loop NumberToWords = Trim(result) End Function Private Function ConvertChunk(ByVal p As Long, ones As Variant, tens As Variant) As String Dim s As String If p >= 100 Then s = ones(p \ 100) & " Hundred" p = p Mod 100 If p > 0 Then s = s & " " End If If p >= 20 Then s = s & tens(p \ 10) If p Mod 10 > 0 Then s = s & "-" & ones(p Mod 10) ElseIf p > 0 Then s = s & ones(p) End If ConvertChunk = s End Function - Close the editor and test. Return to Excel, click an empty cell, and type
=NumberToWords(1234). Press Enter. You should see "One Thousand Two Hundred Thirty-Four". - Point it at a cell. In B1 enter
=NumberToWords(A1)and fill down. Any number in column A now becomes words in column B. - Handle decimals if needed. The function above ignores cents. If you need "and 50/100" style output, add a wrapper that splits the integer and decimal parts with Int() and a rounded remainder, then concatenates the words.
- Save and back up. Save the
.xlsmfile. Copy the module text into a plain text file as a backup in case the workbook is corrupted or shared with someone whose macro settings block it.
Common Mistakes
- Pasting into the wrong place. Code pasted into a worksheet object instead of a standard module will not be callable from a cell. Always use Insert > Module.
- Saving as .xlsx. Excel silently strips VBA when you save as a normal workbook. The function disappears on reopen.
- Forgetting the leading equals sign. Typing
NumberToWords(100)in a cell without=just stores text. - Passing text instead of numbers. If A1 contains "1,234" as text, the function may error. Clean the data with VALUE() or trim the commas first.
- Using a name that clashes. Naming the function the same as a built-in or another macro causes ambiguity. Keep it unique, e.g.
NumToWords. - Expecting it to work in Excel for the web. The browser version cannot run VBA at all; the cell will show #NAME?.
Tips
- Keep the helper arrays at module level if you call the function thousands of times; rebuilding them per call is slower on large ranges.
- Use
Application.Volatileonly if you truly need recalculation on every sheet change; otherwise leave it out for speed. - For invoices, wrap the output in
PROPER()or build capitalisation into the function so the first letter is uppercase. - Test edge cases: 0, 10, 11, 19, 20, 21, 100, 101, 110, 1000, 1000000. These catch most off-by-one errors in chunk logic.
- If you share the workbook, add a note on the sheet explaining that macros must be enabled, and consider a signed certificate to reduce security prompts.
Troubleshooting
- #NAME? in the cell. The function is not visible to Excel. Check the module exists, the function is Public (no Private keyword on the main function), and macros are enabled.
- Compile error on paste. Usually a smart-quote or line-break issue from copying. Retype the quote characters or paste into Notepad first to strip formatting.
- Wrong words for large numbers. The scales array only goes to Billion. Extend it with "Trillion" and adjust the upper limit check if you need bigger values.
- Macro blocked banner. Click Enable Content, or move the file to a Trusted Location via File > Options > Trust Center > Trust Center Settings > Trusted Locations. Only do this for files you created or trust.
- Function works but returns blank. The input is likely empty or zero handled incorrectly. Test with a literal number first, then with the cell reference.
- File opens with no code. It was saved as .xlsx. Re-paste the code and save as .xlsm immediately.
Frequently Asked Questions
Can I convert numbers to words without VBA?
Not natively. Excel has no built-in number-to-words formula. You can use a very long nested IF or a lookup table for small ranges, but VBA is the practical route for anything beyond a few dozen values.
Does this work in Google Sheets?
No. Google Sheets uses Apps Script (JavaScript), not VBA. The logic can be ported, but the code above will not run there.
Will the function update when the source number changes?
Yes, because it is a normal worksheet function. Editing A1 recalculates B1 automatically, provided calculation is set to automatic.
Can it handle currency with cents?
Not as written. You would add a wrapper that converts the integer part and appends the cents as a fraction, for example "One Hundred Twenty-Three and 45/100".
Why does my file ask to enable macros every time?
Macro security prompts appear for files outside Trusted Locations. Saving in a trusted folder or signing the project with a digital certificate reduces the prompts.
Is there a limit to the number size?
The version above handles up to 999,999,999,999 (just under one trillion). Larger values return "Number too large" until you extend the scales array.