To convert a number to text (such as changing 125 to "One Hundred Twenty Five") in Excel, you must create a User Defined Function (UDF) using VBA, as Excel does not have a built-in function for this specific task. By writing a custom script in the Visual Basic Editor, you can create a formula—typically named something like =SpellNumber(A1)—that can be used across your entire workbook to automate the conversion of currency or plain integers into written English words.

What You'll Need

  • Microsoft Excel installed on a Windows or Mac computer.
  • A workbook saved in the Excel Macro-Enabled Workbook (.xlsm) format.
  • Basic access to the Developer tab or the ability to use the Alt + F11 keyboard shortcut.
  • Administrative permissions to enable macros on your machine.

Step-by-Step

  1. Open the Visual Basic Editor: Launch your Excel workbook. Press Alt + F11 on your keyboard. This shortcut opens the VBA editor window, which is a separate environment from the standard spreadsheet grid. If you are on a Mac, you may need to use the Option + F11 combination or enable the Developer tab via Excel Preferences > Ribbon & Toolbar.
  2. Insert a New Module: In the VBA editor, look at the top menu bar. Click on Insert and then select Module. This creates a blank white space where you can paste your custom code. It is critical to place the code in a Module rather than in "ThisWorkbook" or a specific "Sheet" object, as functions placed in modules are globally accessible to all sheets in that workbook.
  3. Paste the Conversion Code: Copy a standard "SpellNumber" VBA script and paste it into the new module window. Because a full number-to-text conversion requires handling units, tens, hundreds, and thousands, the code typically consists of several sub-functions. One function handles the main number, another handles the "tens" (like twenty, thirty), and another handles the "units" (one, two). Ensure the code you use includes logic for decimals if you are converting currency (e.g., converting .50 to "and Fifty Cents").
  4. Customize the Currency Labels: Within the code you pasted, look for the strings that define the currency. You will likely see words like "Dollars" and "Cents". If you are working with Pounds, Euros, or a different currency, manually change these text strings inside the quotation marks to match your needs. For example, change " Dollars" to " Euros".
  5. Save the Workbook Correctly: This is the most important step for persistence. Close the VBA editor and return to your Excel sheet. Go to File > Save As. In the file type dropdown menu, you must select Excel Macro-Enabled Workbook (*.xlsm). If you save it as a standard .xlsx file, all your VBA code will be permanently deleted when you close the file.
  6. Apply the Function in the Sheet: Now that the UDF is active, you can use it like any other Excel formula. Click on a cell and type =SpellNumber(A1), replacing A1 with the cell containing the number you wish to convert. Press Enter, and the number will be transformed into written text.

Common Mistakes

The most frequent error is saving the file in the wrong format. Many users spend time writing the code only to find it missing the next day because they saved the file as a standard .xlsx. Always verify the file extension is .xlsm.

Another common mistake is placing the code in the wrong location. If the code is pasted into the Sheet1 or ThisWorkbook object instead of a Module, the =SpellNumber() formula will return a #NAME? error because Excel cannot find the function in the global scope.

Users also frequently forget to enable macros upon reopening the file. When you open an .xlsm file, Excel usually displays a yellow security warning bar at the top stating "Macros have been disabled." You must click "Enable Content" for the number-to-text function to work; otherwise, the cells will show an error.

Finally, some users attempt to use the function on cells that are already formatted as text but contain non-numeric characters (like symbols or letters). The VBA function expects a numeric input; passing it a string that cannot be converted to a number will result in a #VALUE! error.

Tips

To make your converted text look professional, wrap your VBA function inside the UPPER, LOWER, or PROPER functions. For example, =PROPER(SpellNumber(A1)) will ensure that the first letter of every word is capitalized, which is ideal for formal invoices or checks.

If you need this function available in every single Excel file you open (not just one specific workbook), you should save the code in the Personal.xlsb (Personal Macro Workbook). This is a hidden workbook that loads every time Excel starts, allowing you to use your custom number-to-text tool across all your spreadsheets without copying the code repeatedly.

For those handling very large numbers, ensure the VBA code uses the Double or Variant data type rather than Integer. In VBA, an Integer is limited to 32,767. If you try to convert a number like 50,000 using an Integer-based script, the code will crash with an "Overflow" error.

Troubleshooting

If the formula returns a #NAME? error, first check that you inserted a Module and didn't paste the code into a Sheet object. If that is correct, check that the name of the function in the VBA code (e.g., Function SpellNumber(ByVal MyNumber)) exactly matches the name you are typing into the cell. VBA is not case-sensitive for function calls, but the spelling must be identical.

If you encounter a "Compile Error: Variable not defined," it is likely because the code you copied has Option Explicit at the top, but some variables were not properly declared. You can either declare the missing variables or remove the Option Explicit line from the very top of the module to allow implicit declarations.

If the function returns the wrong words (e.g., saying "Ten" instead of "Eleven"), the logic in the "Units" array of the VBA code is likely flawed. Review the section of the code that handles numbers between 11 and 19, as these are "special cases" in English that do not follow the standard "ty-one, ty-two" pattern of other decades.

If the workbook becomes slow or freezes when you have thousands of these formulas, consider converting the results to static text. Copy the cells with the formulas, right-click, and select Paste Values. This removes the live VBA calculation and keeps only the written text, which significantly improves performance.

Frequently Asked Questions

Can I use this on Excel Online or Google Sheets?

No, VBA (Visual Basic for Applications) only works on the desktop versions of Excel for Windows and Mac. Excel Online uses Office Scripts (TypeScript), and Google Sheets uses Apps Script (JavaScript), so the VBA code will not run in a web browser.

Does this work for negative numbers?

Standard SpellNumber scripts are often written for positive currency. To handle negative numbers, you must add an If MyNumber < 0 Then statement at the beginning of the function to prepend the word "Negative" or "Minus" to the result.

How do I handle decimals that aren't currency?

If you don't want the result to say "Cents," you can modify the code to replace the currency strings with "point" and "hundredths." Look for the section of the code that handles the decimal remainder and change the output text accordingly.

Will this work if I share the file with someone else?

Yes, as long as you save the file as an .xlsm and the recipient enables macros when they open the file. If the recipient's company has a strict security policy that blocks all macros, the function will not work for them.

Is there a way to do this without VBA?

There is no single built-in function, but it is possible using an extremely long and complex nested IF or CHOOSE formula. However, these are difficult to maintain and often hit the character limit for formulas, which is why VBA is the industry-standard approach.