Excel does not have a built-in function to convert numbers into words (e.g., changing 125 to "One Hundred Twenty Five"). To achieve this, you must use a custom User Defined Function (UDF) created via Visual Basic for Applications (VBA). This process involves pasting a specific script into the workbook's backend, which then allows you to use a formula like =SpellNumber(A1) anywhere in that file to automatically translate digits into text.

What You'll Need

  • A desktop version of Microsoft Excel (Windows or macOS). Note that Excel for the Web does not support VBA macros.
  • A workbook where you have permission to save files in the "Excel Macro-Enabled Workbook" (.xlsm) format.
  • The VBA code script (provided in the steps below) to handle the linguistic conversion logic.
  • Basic access to the Developer tab or the shortcut keys to open the Visual Basic Editor.

Step-by-Step

  1. Open the Visual Basic Editor: Launch your Excel workbook. Press Alt + F11 on your keyboard. This is the universal shortcut to open the VBA Editor window. If you are on a Mac, you may need to use Option + F11 or go to the Tools menu and select Macro > Visual Basic Editor.
  2. Insert a New Module: In the VBA Editor window, look at the menu bar at the top. Click on Insert and then select Module. This creates a blank white page where you can place the custom code. It is important to insert a Module rather than placing the code directly into "ThisWorkbook" or a specific sheet, as this ensures the function is available globally across all sheets in the file.
  3. Paste the SpellNumber Code: Copy the following VBA script and paste it into the blank module window. (Note: Since VBA code is extensive, ensure you copy every line from the beginning of the function to the final End Function statement).

    Function SpellNumber(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 SpellNumber = Dollars & Cents End Function Function GetHundreds(ByVal MyNumber) Dim Result As String If Val(MyNumber) = 0 Then Exit Function If Mid(MyNumber, 1, 1) <> "0" Then Result = GetDigit(Mid(MyNumber, 1, 1)) If Val(Mid(MyNumber, 2)) = 0 Then Result = Result & " Hundred " Else Result = Result & " Hundred " & GetTens(Mid(MyNumber, 2)) End If 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 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
  4. Save and Close the Editor: Once the code is pasted, you do not need to "run" the code. Simply click the Save icon or press Ctrl + S. Close the VBA window by clicking the X in the top right corner to return to your Excel spreadsheet.
  5. Apply the Formula: Now, you can use the function just like any other Excel formula. If your number is in cell A1, click on cell B1 and type =SpellNumber(A1). Press Enter, and the number will be converted to words.
  6. Save as Macro-Enabled Workbook: This is the most critical step. Go to File > Save As. In the file type dropdown menu, select Excel Macro-Enabled Workbook (.xlsm). If you save it as a standard .xlsx file, the VBA code will be deleted, and your formulas will show a #NAME? error the next time you open the file.

Common Mistakes

The most frequent error users encounter is saving the file in the wrong format. Because standard .xlsx files are designed to be secure and cannot contain executable code, Excel strips out all VBA modules upon saving. Always ensure the extension is .xlsm. Another common mistake is pasting the code into the "Sheet" object instead of a "Module". If you paste the code into "Sheet1", the function will only work on that specific sheet. By using Insert > Module, you make the function global for the entire workbook.

Users also frequently forget that VBA is not case-sensitive for the function name, but it must match the name defined in the code. If the code says Function SpellNumber, typing =SPELLNUMBER(A1) will work, but typing =ConvertNumber(A1) will result in an error because that function name does not exist in the script.

Tips

To make the output more professional, you can combine the SpellNumber function with other Excel functions. For example, if you want the result to be in all capital letters, use =UPPER(SpellNumber(A1)). If you want it in proper case (first letter of each word capitalized), use =PROPER(SpellNumber(A1)).

If you need to use this function across many different workbooks, you can save the code in a "Personal Macro Workbook". This is a hidden workbook that opens every time you start Excel. By placing the SpellNumber module there, you can use the function in any file without having to paste the code repeatedly. To do this, record a dummy macro and select "Personal Macro Workbook" as the destination; this forces Excel to create the file. Then, open the VBA editor and move the SpellNumber code into that Personal.xlsb module.

For those dealing with currencies other than Dollars and Cents, you can manually edit the VBA code. Look for the lines that say Dollars = " Dollars" and Cents = " Cents". You can change these to "Euros", "Pounds", or "Rupees" to match your local currency requirements.

Troubleshooting

If the formula returns a #NAME? error, it means Excel cannot find the function. First, check if you saved the file as an .xlsm. If you did, go back to the VBA Editor (Alt + F11) and verify that the code is located in a Module, not in a Sheet or ThisWorkbook object. If the code is missing, you will need to paste it again.

If you see a security warning at the top of the screen saying "Macros have been disabled", you must click Enable Content. Excel disables macros by default to protect users from malicious code. The SpellNumber function will not calculate until you grant permission for macros to run in that specific session.

If the conversion is slightly inaccurate (for example, it says "No Dollars" for a zero value but you want it to say "Zero Dollars"), you can modify the Select Case Dollars section of the code. Change Case "": Dollars = "No Dollars" to Case "": Dollars = "Zero Dollars". After making changes in the VBA editor, remember to save the workbook again.

Frequently Asked Questions

Does this work in Google Sheets?

No, Google Sheets uses Apps Script (based on JavaScript), whereas Excel uses VBA. You would need a completely different script written in JavaScript to achieve this in Google Sheets.

Can I use this on Excel for the Web?

No, the web-based version of Excel does not support VBA macros. You must open the file in the desktop application to use the SpellNumber function.

Is there a way to do this without VBA?

There is no simple single function to do this. You could technically create a massive, nested IF statement combined with MID and LEFT functions, but it would be incredibly complex, prone to errors, and would likely exceed the character limit for a cell formula. VBA is the standard professional approach.

Will this work for very large numbers?

The provided script handles numbers up to the trillions. If you are working with numbers larger than 999 trillion, the script would need additional "Place" definitions (e.g., Quadrillions) added to the array at the beginning of the code.

Can I convert numbers to words in a language other than English?

The provided code is specifically for English. To convert numbers to words in Spanish, French, or another language, you would need a version of the script where the word strings (e.g., "One", "Two", "Ten") are translated into the target language.