How to Convert Amounts to Words in Excel
In this article
Excel does not include a native function to convert numbers into text words, such as turning "100" into "One Hundred." To achieve this, you must use a Visual Basic for Applications (VBA) macro. This guide explains how to create and apply a custom User Defined Function (UDF) that automatically converts numeric values into their written English equivalents, which is essential for generating professional invoices, checks, or financial reports.
What You'll Need
- Microsoft Excel installed on your computer (desktop version).
- Basic familiarity with the Excel interface.
- A workbook where you intend to enter numerical data.
- Administrative permissions to enable macros if required by your organization's security settings.
Step-by-Step
- Open the VBA Editor: Press
Alt + F11on your keyboard to open the Microsoft Visual Basic for Applications editor. Alternatively, go to the Developer tab in the ribbon and click Visual Basic. If the Developer tab is not visible, right-click the ribbon, select Customize the Ribbon, and check the box next to Developer. - Insert a New Module: In the VBA editor window, locate the Project Explorer pane on the left. Right-click anywhere within the project name corresponding to your current workbook. Select Insert from the context menu, then choose Module. A new code window will appear on the right side of the screen.
- Paste the Conversion Code: Copy the following VBA code snippet and paste it into the new module window. This code defines a function named
NumberToWordsthat handles integers up to trillions and includes logic for cents. - Define the Function Logic: Ensure the pasted code includes the helper functions for converting single digits, tens, and hundreds, as well as the main loop that processes groups of three digits (thousands, millions, billions). The code should return a string value based on the input number.
- Close the VBA Editor: Click the X button on the top-right corner of the VBA window or press
Alt + Qto return to the standard Excel worksheet view. - Use the Custom Function: Click on an empty cell where you want the word representation to appear. Type the formula
=NumberToWords(A1), replacingA1with the reference to the cell containing your numeric amount. PressEnter. - Format the Output: The result will display the number in words. For currency, you may need to concatenate the text with a currency symbol or label. For example, use
="Rupees " & NumberToWords(INT(A1)) & " and Paise " & NumberToWords(MOD(A1*100,100))to handle decimal places specifically for Indian Rupees, or adjust the labels for Dollars and Cents. - Save as Macro-Enabled Workbook: Go to File > Save As. In the file type dropdown menu, select Excel Macro-Enabled Workbook (*.xlsm). Saving as a standard .xlsx file will delete the VBA code, causing the function to stop working.
Common Mistakes
Users often encounter errors due to minor procedural oversights. One frequent mistake is saving the file as a standard Excel Workbook (.xlsx). Since .xlsx files do not support macros, the VBA code is stripped out upon saving, resulting in a #NAME? error when reopening the file. Always save as .xlsm.
Another common issue is incorrect syntax in the formula. Ensure there are no spaces between the function name and the opening parenthesis, and that the cell reference is valid. Additionally, users sometimes forget to enable macros when opening the file from another source. If the content bar appears at the top of Excel, click Enable Content to allow the VBA script to run.
Tips
To make the function more versatile, consider adding optional parameters to the VBA code. For instance, you can modify the function to accept a boolean argument for "And" usage or to specify whether to include currency names like "Dollars" and "Cents" directly within the function rather than concatenating them in the cell formula.
If you work with multiple currencies, you can create separate functions for each (e.g., USDToWords, EURToWords) or add a second argument to your existing function to specify the currency type. This keeps your spreadsheet organized and reduces the complexity of individual cell formulas.
For large datasets, avoid using volatile functions unnecessarily. While the custom UDF is generally efficient, recalculating thousands of cells every time a change occurs can slow down performance. Consider copying the results and pasting them as values once the invoice or report is finalized to improve speed.
Troubleshooting
If the formula returns a #NAME? error, verify that the VBA module was saved correctly and that the function name in the cell matches the name defined in the code exactly, including case sensitivity if applicable (though VBA is typically case-insensitive). Also, ensure that macros are enabled in the Trust Center settings under File > Options > Trust Center > Trust Center Settings > Macro Settings.
If the output shows incorrect grammar or missing words, check the VBA code for logical errors in the helper functions. Specifically, review the arrays that store word strings for units, tens, and hundreds. A typo in these arrays, such as "Thousandss" instead of "Thousands," will propagate through all calculations.
In some cases, security software may block the execution of macros. Temporarily disable antivirus scanning for the specific folder containing your Excel files to test if this resolves the issue. If it does, add an exception for the folder in your security software settings.
Frequently Asked Questions
Can I convert numbers to words without using VBA?
No, Excel does not have a built-in formula for this task. You must use VBA macros or third-party add-ins to achieve number-to-word conversion.
Does this work in Excel Online?
No, Excel Online does not support VBA macros. You must use the desktop version of Excel to create and run the custom function.
How do I handle negative numbers?
The basic code usually ignores signs. You can modify the VBA function to check if the input is less than zero and prepend the word "Negative" to the result string.
Can I customize the language?
Yes, but you must manually edit the VBA code. Replace the English word arrays with translations for other languages. Note that grammatical rules vary significantly between languages, so simple array replacement may not suffice for complex inflections.
Why does my function break when I move the file?
If you copy the worksheet to a new workbook without also copying the VBA module, the function definition is lost. You must import the module into the new workbook via the VBA editor (File > Import File) or recreate the steps in the new file.