How to Fix Spell Number Now Working Issues in Excel

For checks, invoices, contracts, or official reports, many Excel users require numbers to be expressed in English words. The SpellNumber worksheet function is not built into Excel. Therefore, it is typically necessary to utilize a user-defined function (VBA) in Excel 365 to convert numbers to words. While executing this, a few setup, security settings or coding issues are typically the reason why a spell number solution doesn’t seem to be working.

In order to get you back to reliably generating number-to-word text, this article outlines every common cause of spell number not working. We have explained how to fix each one step-by-step by providing a robust VBA UDF (copy-paste ready), displaying installation options and fixing issues in the workbook/module and add-in. This guide also includes a useful troubleshooting checklist and frequently asked questions.

Key Takeaways

Steps to make spell number work properly in Excel:

➤ In the Visual Basic Editor, go to Insert > Module and copy paste the code for Spell Number.
➤ Go to File > Options > Trust Center > Trust Center Settings.
➤ Select Macro Settings and choose Enable VBA macros (not recommended; potentially dangerous code can run).
➤ Save the file as Excel Macro-Enabled Workbook (*.xlsm).
➤ In cell C2, put in the formula: =SpellNumber1(A2). Use the Fill Handle to apply to all cells.

overview image

Download Practice Workbook
1

Install and Use a VBA SpellNumber UDF

The most popular and adaptable method for spelling numbers in desktop Excel is to use a VBA User-Defined Function (UDF). Currency words, decimals (cents), negative values, and translation can all be supported with a UDF. Additionally, you can customize the function to return precisely the phrase you require, such as “Rupees and Paise” rather than “Dollars and Cents.” Although it won’t work on Excel Online and requires macros to be enabled, VBA offers the most control in desktop Excel.

Steps:

➤ Open your Excel Workbook and press  Alt  +  F11 Â to open the Visual Basic Editor window.

Install and Use a VBA SpellNumber UDF

➤ Right click on the worksheet containing your data then go to Insert > Module.

Install and Use a VBA SpellNumber UDF

➤ In the new module, copy and paste the following code.

Option Explicit
Function SpellNumber1(ByVal mn_MyNumber)
Dim mn_Dollars, mn_Cents, mn_temp_value
Dim mn_decimal_place, mn_count
ReDim mn_place(9) As String
mn_place(2) = " Thousand "
mn_place(3) = " Million "
mn_place(4) = " Billion "
mn_place(5) = " Trillion "
mn_MyNumber = Trim(Str(mn_MyNumber))
mn_decimal_place = InStr(mn_MyNumber, ".")
If mn_decimal_place > 0 Then
mn_Cents = CalculateTens(Left(Mid(mn_MyNumber, mn_decimal_place + 1) & _
"00", 2))
mn_MyNumber = Trim(Left(mn_MyNumber, mn_decimal_place - 1))
End If
mn_count = 1
Do While mn_MyNumber <> ""
mn_temp_value = CalculateHundreds(Right(mn_MyNumber, 3))
If mn_temp_value <> "" Then mn_Dollars = mn_temp_value & mn_place(mn_count) & mn_Dollars
If Len(mn_MyNumber) > 3 Then
mn_MyNumber = Left(mn_MyNumber, Len(mn_MyNumber) - 3)
Else
mn_MyNumber = ""
End If
mn_count = mn_count + 1
Loop
Select Case mn_Dollars
Case ""
mn_Dollars = "Zero Dollars"
Case "One"
mn_Dollars = "One Dollar"
Case Else
mn_Dollars = mn_Dollars & " Dollars"
End Select
Select Case mn_Cents
Case ""
mn_Cents = ""
Case "One"
mn_Cents = " and One Cent"
Case Else
mn_Cents = " and " & mn_Cents & " Cents"
End Select
SpellNumber1 = mn_Dollars & mn_Cents
End Function
Function CalculateHundreds(ByVal mn_MyNumber)
Dim mn_result As String
If Val(mn_MyNumber) = 0 Then Exit Function
mn_MyNumber = Right("000" & mn_MyNumber, 3)
If Mid(mn_MyNumber, 1, 1) <> "0" Then
mn_result = StoreDigit(Mid(mn_MyNumber, 1, 1)) & " Hundred "
End If
If Mid(mn_MyNumber, 2, 1) <> "0" Then
mn_result = mn_result & CalculateTens(Mid(mn_MyNumber, 2))
Else
mn_result = mn_result & StoreDigit(Mid(mn_MyNumber, 3))
End If
CalculateHundreds = mn_result
End Function
Function CalculateTens(mn_tens)
Dim mn_result As String
mn_result = ""
If Val(Left(mn_tens, 1)) = 1 Then
Select Case Val(mn_tens)
Case 10: mn_result = "Ten"
Case 11: mn_result = "Eleven"
Case 12: mn_result = "Twelve"
Case 13: mn_result = "Thirteen"
Case 14: mn_result = "Fourteen"
Case 15: mn_result = "Fifteen"
Case 16: mn_result = "Sixteen"
Case 17: mn_result = "Seventeen"
Case 18: mn_result = "Eighteen"
Case 19: mn_result = "Nineteen"
Case Else
End Select
Else
Select Case Val(Left(mn_tens, 1))
Case 2: mn_result = "Twenty "
Case 3: mn_result = "Thirty "
Case 4: mn_result = "Forty "
Case 5: mn_result = "Fifty "
Case 6: mn_result = "Sixty "
Case 7: mn_result = "Seventy "
Case 8: mn_result = "Eighty "
Case 9: mn_result = "Ninety "
Case Else
End Select
mn_result = mn_result & StoreDigit(Right(mn_tens, 1))
End If
CalculateTens = mn_result
End Function
Function StoreDigit(mn_digit)
Select Case Val(mn_digit)
Case 1: StoreDigit = "One"
Case 2: StoreDigit = "Two"
Case 3: StoreDigit = "Three"
Case 4: StoreDigit = "Four"
Case 5: StoreDigit = "Five"
Case 6: StoreDigit = "Six"
Case 7: StoreDigit = "Seven"
Case 8: StoreDigit = "Eight"
Case 9: StoreDigit = "Nine"
Case Else: StoreDigit = ""
End Select
End Function

➤ The code will look like this in the module:

Install and Use a VBA SpellNumber UDF

➤ Select Run > Run Sub/UserForm.

Install and Use a VBA SpellNumber UDF

➤ In the Macro name, name it as SpellNumber and click Run.

Install and Use a VBA SpellNumber UDF

Running the macro at this stage will show a #NAME? error. So, there are a couple of things you need to take care of before you get the desired result from this macro.


2

Check the Macro Security Settings

A lot of macro issues begin with Excel’s built-in security completely preventing them from running. Even secure macros like SpellNumber won’t function since Excel may by default deactivate all macros to stop malicious code from running. The quickest method for restoring macro functionality for a file you can trust is to follow these steps and ensure all macros are enabled.

Steps:

➤ Go to the File tab and select Options.

Check the Macro Security Settings

➤ From the left menu, select Trust Center and go to Trust Center Settings.

Check the Macro Security Settings

➤ In the new window, select Macro Settings.
➤ Choose the option- Enable VBA macros (not recommended; potentially dangerous code can run) among the options.
➤ Click OK, then OK again in the previous menu to exit.

Check the Macro Security Settings


3

Make Sure the Workbook is Macro-Enabled

Even if macro security settings are corrected, Excel will not execute VBA code in a workbook saved as.xlsx. The SpellNumber function will never work since the .xslx file type just does not store macros. Excel will recognize that the file contains and can execute code only if it is converted to a macro-enabled format (.xlsm or.xlam).

Steps:

➤ Go back to the Excel workbook and select File.

Make Sure the Workbook is Macro-Enabled

➤ Select Save As and give the File Name – Spell Number not working in Excel.
➤ In Save as type, choose Excel Macro-Enabled Workbook (*.xlsm).
➤ Press OK.

Make Sure the Workbook is Macro-Enabled


4

Run the Macro with SpellNumber Function integrated Formula

The SpellNumber formula in Excel is a User-Defined Function (UDF) that converts a numeric value into words — for example, turning 123.45 into “One Hundred Twenty Three Dollars and Forty Five Cents.  Once the function is properly installed and macros are enabled, it can be used in a worksheet just like built-in formulas.

Steps:

➤ Click on cell B2 and type in the formula:

=SpellNumber1(A2)

➤ Click and drag the Fill Handle to apply the formula to the rest of the cells in column B.

Run the Macro with SpellNumber Function integrated Formula

➤ The UDF will return the number in column A spelled out in words as US currency dollars and cents now.

Run the Macro with SpellNumber Function integrated Formula


5

Load VBA as Add-in to Spell Numbers

You can make your VBA module an add-in if you want SpellNumber to be accessible in every workbook without requiring you to paste code repeatedly. By saving your macro-enabled workbook as an Excel Add-in (.xlam) and loading it through Excel’s Add-ins manager, the SpellNumber function becomes part of your personal Excel environment.

Steps:

➤ Go to the Excel workbook and select File.

Load VBA as Add-in to Spell Numbers

➤ Select Save As and give the File Name – Spell Number not working in Excel.
➤ In Save as type, choose Excel Add-in(*.xlam).
➤ Press OK.

Load VBA as Add-in to Spell Numbers

➤ Now, go to the File tab and select Options.

Load VBA as Add-in to Spell Numbers

➤ From the left menu, select Add-ins and then click Go.

Load VBA as Add-in to Spell Numbers

➤ From the list of Add-ins, click on Browse.

Load VBA as Add-in to Spell Numbers

➤ Select the file you have saved as .xlam from your folders and click OK.

Load VBA as Add-in to Spell Numbers

➤ Now, the file Spell Number not working in Excel will show up in the list of add-ins. Make sure the box next to it is ticked and press OK.

Load VBA as Add-in to Spell Numbers

➤ The SpellNumber function will now be available globally. Open up a new workbook containing similar values as our dataset.
➤ Click on cell C2, and type in the formula:

=SpellNumber1(A2)

The cell will now display the number in words, based on your add-in’s code.

➤ Click and drag the Fill Handle to apply the formula to the rest of the cells in column B.

Load VBA as Add-in to Spell Numbers

➤ The formula will directly return the number in column A spelled out in words as US currency dollars and cents. Unless you manually disable it in the Add-ins menu, SpellNumber will always be ready to use in every Excel session.

Load VBA as Add-in to Spell Numbers


Frequently Asked Questions

Why Does =SpellNumber() Give Me #NAME Output?

The output showing #NAME means Excel can’t find the SpellNumber function. Make sure you’ve added the VBA code to your workbook or installed it as an add-in. Another reason for this output can be that the macros are disabled in your workbook.

Can I Change the Currency from Dollars and Cents to Any Other Currency?

Yes, you can get the output in any currency you want. All you need to do is edit the dollars and cents strings in your VBA code and replace them with the currency you want. For example, you can replace them with Rupee and Paise and get the output in Indian currency then.

Will the SpellNumber Function Work in Excel Online?

No, the SpellNumber Function will not work in Excel Online. VBA-based solutions, including add-ins, work only in desktop Excel versions. As SpellNumber can’t work without VBA, you can’t use it in Excel Online.

Do I Need to Reload the Add-in Every Time I Open Excel?

No, you won’t need to reload the add-in every time you open Excel for some work. As long as the code is installed and ticked in the Add-ins Manager, it will automatically load in the workbook. It will only stop loading when you disable it manually.


Wrapping Up

In this guide, we have explored all the possible reasons the SpellNumber function is not working along with their solutions. To sum up, the most common solutions are to install it via VBA code or load it as an add-in for global access. Enabling the macro, using the correct file format while saving and using the formula correctly can solve all of your problems with the spell number issues. With these steps in place, your SpellNumber function will run reliably whenever you need to convert numbers into words.

ExcelInsider Team
We will be happy to hear your thoughts

Leave a reply

Excel Insider
Logo