You can convert a number to words in Excel by pasting a short VBA function into a standard module, then calling it from any cell with a formula such as =NumberToWords(A1). The function below handles whole numbers from 0 to 999,999,999,999 and returns the amount in words, with optional cents for currency use. No add-in is required, and the code works in Excel for Microsoft 365, Excel 2019 and later on Windows and Mac. Menu labels can differ slightly by version and region, but the path to the VBA editor is the same.
What You'll Need
- Excel for Microsoft 365, Excel 2019 or later (desktop, Windows or Mac). The browser version cannot run VBA.
- A workbook saved as .xlsm (macro-enabled) if you want the function to persist after closing.
- The VBA code below, copied exactly.
Step-by-Step
- Open the VBA editor. In Excel, press
Alt + F11on Windows, orOption + F11on Mac. The Microsoft Visual Basic for Applications window opens. - Insert a standard module. In the editor menu, choose Insert > Module. A blank code window appears. Do not paste into a sheet module or the ThisWorkbook module.
- Paste the function. Copy the following code into the blank module:
Note: theFunction NumberToWords(ByVal MyNumber As Variant) As String Dim Units As Variant, Tens As Variant, Scales As Variant Dim Dollars As String, Cents As String Dim Temp As String, DecPlace As Integer Dim Count As Integer Dim DecimalSeparator As String Units = Array("", "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 Not IsNumeric(MyNumber) Then NumberToWords = "Not a number" Exit Function End If MyNumber = Trim(CStr(MyNumber)) If MyNumber = "" Then NumberToWords = "": Exit Function DecimalSeparator = Application.DecimalSeparator DecPlace = InStr(MyNumber, DecimalSeparator) If DecPlace > 0 Then Cents = GetTens(Left(Mid(MyNumber, DecPlace + 1) & "00", 2)) MyNumber = Trim(Left(MyNumber, DecPlace - 1)) Else Cents = "" End If Count = 1 Do While MyNumber <> "" If Len(MyNumber) > 3 Then Temp = Right(MyNumber, 3) Else Temp = MyNumber End If If Val(Temp) <> 0 Then Dollars = GetHundreds(Temp) & " " & Scales(Count - 1) & " " & Dollars End If If Len(MyNumber) > 3 Then MyNumber = Left(MyNumber, Len(MyNumber) - 3) Else MyNumber = "" End If Count = Count + 1 Loop Dollars = Trim(Dollars) If Dollars = "" Then Dollars = "Zero" If Cents <> "" Then NumberToWords = Dollars & " and " & Cents & " Cents" Else NumberToWords = Dollars End If End Function Private Function GetHundreds(ByVal MyNumber As String) As String Dim Result As String If Val(MyNumber) = 0 Then Exit Function MyNumber = Right("000" & MyNumber, 3) If Left(MyNumber, 1) <> "0" Then Result = Units(Val(Left(MyNumber, 1))) & " Hundred " End If If Mid(MyNumber, 2, 1) <> "0" Then Result = Result & GetTens(Mid(MyNumber, 2)) Else Result = Result & Units(Val(Right(MyNumber, 1))) End If GetHundreds = Trim(Result) End Function Private Function GetTens(TensText As String) As String Dim Result As String If Val(Left(TensText, 1)) = 1 Then Result = Units(Val(TensText)) Else Result = Tens(Val(Left(TensText, 1))) If Val(Right(TensText, 1)) > 0 Then Result = Result & "-" & Units(Val(Right(TensText, 1))) End If End If GetTens = Result End FunctionUnits,TensandScalesarrays are declared inside the function, so the helper functionsGetHundredsandGetTensneed them at module level. To keep this simple, move the threeDimlines and the threeArray(...)assignments to the top of the module (outside any function) and changeDimtoPrivate. Then remove those lines fromNumberToWords. - Save the workbook as macro-enabled. Close the VBA editor, then use File > Save As and choose Excel Macro-Enabled Workbook (*.xlsm). If you save as .xlsx, Excel strips the code when you close the file.
- Test the function. In any cell, type
=NumberToWords(1234.56)and press Enter. You should see One Thousand Two Hundred Thirty-Four and 56 Cents. If you see#NAME?, the code is in the wrong module or macros are disabled. - Use it with cell references. Put a number in A1 and use
=NumberToWords(A1)in B1. Fill the formula down as needed. The result is text, so it will not recalculate if you edit the source number unless automatic calculation is on. - Adjust the wording if needed. To output "Dollars" instead of the default, edit the line
NumberToWords = DollarstoNumberToWords = Dollars & " Dollars". To remove cents entirely, delete theIf Cents <> ""block.
Common Mistakes
- Pasting into the wrong module. Code in a sheet module or ThisWorkbook will not appear as a worksheet function. Always use Insert > Module.
- Saving as .xlsx. The code disappears on close. Save as .xlsm.
- Macro security blocking the function. If you see
#NAME?, check the Trust Center macro settings. The function will not run if macros are disabled. - Decimal separator mismatch. The code reads
Application.DecimalSeparator, so it works with both comma and period locales, but typing a period where your system expects a comma will be treated as text. - Numbers over 999,999,999,999. The
Scalesarray stops at Billion, so larger values return incorrect words. Split the number or extend the array if you need trillions. - Negative numbers. The code does not handle minus signs. Wrap the call:
=IF(A1<0,"Minus "&NumberToWords(ABS(A1)),NumberToWords(A1)).
Tips
- Name the module (for example
modNumberWords) so you can find it later. - Keep a copy of the .xlsm as a template so new workbooks inherit the function.
- Use
NumberToWordsinside other formulas, such as="Amount: "&NumberToWords(A1). - For invoices, round first with
=NumberToWords(ROUND(A1,2))to avoid stray cents from floating-point storage. - If you share the workbook, the recipient must enable macros or the formula shows
#NAME?.
Troubleshooting
If the formula returns #NAME?, the most likely causes are: the code is not in a standard module, macros are disabled, or the workbook was saved as .xlsx. Reopen the VBA editor, confirm the module exists under Modules in the Project pane, and check File > Options > Trust Center > Trust Center Settings > Macro Settings (labels vary by version). If the result is blank, the referenced cell is empty or contains text. If the words are wrong for large numbers, check that the number has no thousands separators typed as text. If the function works in one workbook but not another, the second workbook is missing the module. If Excel shows a security warning on open, choose Enable Content only for files you created or trust.
Frequently Asked Questions
Does this work in Excel for the web?
No. Excel for the web cannot run VBA. Use the desktop app.
Can I convert currency amounts with dollar signs?
Yes. Strip the symbol first with SUBSTITUTE or format the cell as a number, then pass the value to NumberToWords.
Why does my result show "Not a number"?
The cell contains text, a space, or a currency symbol. Clean it with VALUE(TRIM(A1)) before calling the function.
Can I use this in Google Sheets?
No. Google Sheets uses Apps Script, not VBA. The logic can be ported, but the code above will not run there.
Will the function survive if I copy the sheet to another workbook?
Only if you also copy the module. Right-click the module in the Project pane and choose Export File, then import it into the other workbook.
Does it handle decimals other than two places?
It reads only the first two digits after the decimal separator. Round the source value to two decimals first.