Converting a numeric amount into its word representation in Excel is useful for financial documents, invoices, checks, and formal reports where numbers must be spelled out to prevent tampering or ensure clarity. Excel does not have a built-in function for this conversion, so you need to use a custom VBA (Visual Basic for Applications) function. This guide walks you through adding the function step by step, using it in your worksheet, and troubleshooting common issues. No additional software is required beyond Excel with macro capabilities enabled.
What You'll Need
- Microsoft Excel (Windows or Mac version that supports VBA)
- Basic familiarity with opening the VBA editor (no prior coding experience required)
- Macro settings enabled to allow custom functions
Step-by-Step
- Open your Excel workbook and press ALT + F11 (Windows) or OPT + F11 or FN + OPT + F11 (Mac) to open the VBA editor. If the Developer tab is visible, you can also click Developer > Visual Basic.
- In the VBA editor, click Insert > Module from the menu bar. This creates a new module where you’ll paste the function code.
- Copy and paste the following VBA code into the module window exactly as shown:
Function AmountToWords(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 MyNumber = Left(MyNumber, Len(MyNumber) - 3) Else MyNumber = "" End If 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 = " and No Cents" Case "One" Cents = " and One Cent" Case Else Cents = " and " & Cents & " Cents" End Select AmountToWords = Dollars & Cents End Function Function GetHundreds(ByVal MyNumber) Dim Result As String If Val(MyNumber) = 0 Then Exit Function MyNumber = Right("000" & MyNumber, 3) If Val(Left(MyNumber, 1)) > 0 Then Result = GetDigit(Left(MyNumber, 1)) & " Hundred " End If If Val(Mid(MyNumber, 2, 1)) > 0 Or Val(Right(MyNumber, 1)) > 0 Then Result = Result & GetTens(Mid(MyNumber, 2)) Else Result = Result & GetDigit(Mid(MyNumber, 2, 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" 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 " End Select Result = Result & GetDigit(Right(TensText, 1)) End If GetTens = Result End Function Function GetDigit(Digit) Select 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 - After pasting the code, close the VBA editor by clicking the X in the top-right corner or pressing ALT + Q. Return to your Excel worksheet.
- In any cell, type the formula
=AmountToWords(A1)(assuming the number is in cell A1) and press Enter. The cell will display the amount in words, including dollars and cents. - To apply the function to multiple cells, drag the fill handle (small square at the bottom-right of the cell) down or across to copy the formula to other cells.
- If you plan to reuse this function in other workbooks, save your current file as a Macro-Enabled Workbook (.xlsm) via File > Save As and choose the .xlsm format.
Common Mistakes
- Pasting the code into the wrong location, such as a sheet module or the ThisWorkbook module, instead of a standard module. Always use Insert > Module.
- Forgetting to save the file as a macro-enabled workbook (.xlsm), which causes the VBA code to be lost when closing and reopening the file.
- Using commas or currency symbols (like $) in the source number, which can cause the function to return an error or incorrect output. Enter numbers as plain values (e.g., 1234.56, not $1,234.56).
- Macro security settings blocking the function from running. If you see a #NAME? error, check that macros are enabled.
- Misplacing decimal points or entering text instead of numbers, leading to unexpected results.
Tips
- To convert only the dollar amount without cents, modify the final line of the AmountToWords function to return just Dollars (remove the Cents concatenation).
- If you need the output in title case (e.g., "One Hundred Twenty-Three Dollars"), wrap the function in
=PROPER(AmountToWords(A1)). - For international currencies, replace "Dollars" and "Cents" in the code with your local currency names (e.g., "Euros" and "Cents" or "Pounds" and "Pence").
- To handle negative numbers, add a line at the start of AmountToWords:
If MyNumber < 0 Then AmountToWords = "Minus " & AmountToWords(Abs(MyNumber)): Exit Function. - Test the function with known values like 0 (should return "No Dollars and No Cents"), 1 ("One Dollar and No Cents"), and 0.99 ("No Dollars and Ninety Nine Cents") to verify correctness.
Troubleshooting
- If you see a #NAME? error, first confirm that the code was pasted into a standard module and that the workbook is saved as .xlsm. Then, 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.
- If the function returns incorrect words, double-check the code for typos, especially in the function names and string literals. A single misspelled word like "GetHundreds" vs "GetHundred" will break the function.
- If the function works on one computer but not another, verify that both systems have macro execution enabled and that the VBA project is not digitally signed or blocked by group policy.
- For very large numbers (over 999 trillion), the function may return blank or incorrect results due to the Place array limits. Extend the Place array if needed (e.g., Place(6) = " Quadrillion ").
- If the VBA editor won’t open or the Developer tab is missing, enable it via File > Options > Customize Ribbon and check the "Developer" box.
Frequently Asked Questions
Can I use this function in Excel Online or Excel for mobile?
No, the AmountToWords function relies on VBA, which is not supported in Excel Online, Excel for iOS, or Excel for Android. You must use the desktop version of Excel (Windows or Mac) with macro support enabled.Is it safe to enable macros to use this function?
Enabling macros poses a security risk if the workbook comes from an untrusted source, as macros can execute harmful code. Only enable macros for workbooks you create or receive from trusted sources. Always scan files with antivirus software before opening.Can I convert numbers to words in other languages using this method?
The provided VBA code is hardcoded for English. To convert to another language, you would need to rewrite the GetDigit, GetTens, and GetHundreds functions with the appropriate vocabulary and grammar rules for that language.Why does the function show "No Dollars" when I enter zero?
This is by design. The function treats zero as "No Dollars" to avoid ambiguity in financial contexts. If you prefer "Zero Dollars", change the lineCase "": Dollars = "No Dollars" to Case "": Dollars = "Zero Dollars" in the AmountToWords function.
Can I remove the "and" between dollars and cents?
Yes. To remove the "and", edit the Cents section in the AmountToWords function: changeCents = " and " & Cents & " Cents" to Cents = " " & Cents & " Cents" (note the leading space). For no cents at all, set Cents to an empty string.