Excel Number to Words: Formula, VBA, and How to Use It

VBA & macros · Updated November 3, 2026

Excel Number to Words: Formula, VBA, and How to Use It

Excel has no built-in English worksheet formula that converts an ordinary number into words. In Microsoft 365 for Windows, you can add a small VBA custom function and then use =NumberToWords(A2) to turn a nonnegative whole number in A2 into text.

Why Excel needs a custom function

Excel stores numbers as values for calculation; it does not automatically spell them out as words. Functions such as TEXT change how a value is displayed, but they do not translate digits into phrases. For example, number formatting can show a value with commas or currency symbols, while a number-to-words function must build words such as “one thousand two hundred.”

That distinction matters when preparing forms, invoices, checks, or reports. A cell that displays 1250 as $1,250.00 is still numeric. A cell that displays “one thousand two hundred fifty” contains text. Excel can calculate with the original number, but the written version is generally for reading or printing.

Excel does include BAHTTEXT for converting a number to Thai text with baht-related wording. It is not a general English number-to-words function, so it will not solve the usual request to spell out a number in English.

What the VBA function does

The example below creates a user-defined function, often shortened to UDF. Once the code is in a workbook module, the function can be called from a worksheet cell much like a built-in function. This version writes nonnegative whole numbers from 0 through 999,999,999,999 in English, using US-style wording without “and” between hundreds and tens. For instance, it produces “one hundred twenty-five” for 125.

It deliberately rejects negative values, decimals, and numbers above its stated limit instead of silently rounding them or returning an inaccurate phrase. Its output is plain text, not a currency amount, and it does not add a dollar sign, cents, or a currency name.

Add the function to a workbook

  1. Save the workbook as an Excel Macro-Enabled Workbook (*.xlsm) so it can retain VBA code.
  2. On Windows, press Alt+F11 to open the Visual Basic Editor. Choose Insert > Module.
  3. Paste the complete code below into the module, then return to the worksheet and save the workbook.
  4. If Excel displays a security warning, enable macros only for a workbook and source you trust. The function will not work if its VBA code is disabled.

On a Mac, open the Visual Basic Editor from Tools > Macro > Visual Basic Editor; keyboard shortcuts vary by keyboard and Excel settings. The VBA function itself is the same. Excel for the web can display a macro-enabled workbook, but it cannot create, edit, or run VBA code, so set up and use this UDF in desktop Excel.

VBA code for whole numbers

Paste both procedures into the same standard module. The public procedure is the worksheet function; the private helper converts each group of up to three digits. The function returns a descriptive text message for unsupported inputs so you can spot the issue in the result cell.

Public Function NumberToWords(ByVal value As Variant) As String
    Dim n As Double
    Dim groupValue As Long
    Dim groupIndex As Long
    Dim result As String
    Dim piece As String
    Dim scales As Variant

    If IsError(value) Then
        NumberToWords = "Input must be a whole number from 0 to 999,999,999,999."
        Exit Function
    End If
    If Not IsNumeric(value) Then
        NumberToWords = "Input must be a whole number from 0 to 999,999,999,999."
        Exit Function
    End If

    n = CDbl(value)
    If n < 0 Or n > 999999999999# Then
        NumberToWords = "Input must be a whole number from 0 to 999,999,999,999."
        Exit Function
    End If
    If n <> Fix(n) Then
        NumberToWords = "Input must be a whole number from 0 to 999,999,999,999."
        Exit Function
    End If
    If n = 0 Then
        NumberToWords = "zero"
        Exit Function
    End If

    scales = Array("", " thousand", " million", " billion")
    groupIndex = 0
    Do While n > 0
        groupValue = CLng(n - Fix(n / 1000) * 1000)
        If groupValue > 0 Then
            piece = WordsUnder1000(groupValue) & scales(groupIndex)
            If result = "" Then
                result = piece
            Else
                result = piece & " " & result
            End If
        End If
        n = Fix(n / 1000)
        groupIndex = groupIndex + 1
    Loop

    NumberToWords = result
End Function

Private Function WordsUnder1000(ByVal n As Long) As String
    Dim ones As Variant
    Dim tens As Variant
    Dim hundreds As Long
    Dim remainder As Long
    Dim result As String
    Dim piece As String

    ones = Array("zero", "one", "two", "three", "four", "five", _
        "six", "seven", "eight", "nine", "ten", "eleven", _
        "twelve", "thirteen", "fourteen", "fifteen", "sixteen", _
        "seventeen", "eighteen", "nineteen")
    tens = Array("", "ten", "twenty", "thirty", "forty", "fifty", _
        "sixty", "seventy", "eighty", "ninety")

    hundreds = n \ 100
    remainder = n Mod 100
    If hundreds > 0 Then result = ones(hundreds) & " hundred"

    If remainder > 0 Then
        If remainder < 20 Then
            piece = ones(remainder)
        Else
            piece = tens(remainder \ 10)
            If remainder Mod 10 > 0 Then
                piece = piece & "-" & ones(remainder Mod 10)
            End If
        End If
        If result <> "" Then result = result & " "
        result = result & piece
    End If

    WordsUnder1000 = result
End Function

This code uses ordinary US English conventions: it omits “and” in phrases such as “one hundred one” and hyphenates compound tens such as “forty-two.” Spelling and punctuation conventions differ across regions and style guides; change the helper if your organization requires a different house style. The code is a worksheet function, not a procedure that edits cells. If you later run a VBA macro that changes workbook contents, save a copy first: macro actions cannot be undone with Ctrl+Z.

Use the function in a worksheet

Suppose A2 contains the numeric value 1250. In another cell, such as B2, enter this formula:

=NumberToWords(A2)

The result is “one thousand two hundred fifty.” If A2 contains 0, the result is “zero”; if it contains 42, the result is “forty-two.” You can fill the formula down beside a list of values, just as you would with many other worksheet functions. Keep the source value numeric: a cell containing a number stored as text may be accepted if VBA recognizes it as numeric, but true numeric entries are more dependable.

The formula is saved as part of the worksheet, but its custom function depends on the VBA project remaining in the workbook and macros being permitted. If you send the file to someone, tell them it is an .xlsm workbook with a custom function. A recipient who disables VBA may see a function error rather than the words.

Limits, decimals, and regional wording

The supplied function intentionally covers whole numbers only. A value such as 12.5 returns the whole-number instruction instead of being rounded. That is important because rounding would change the meaning: “twelve” would not communicate the same value as 12.5. Negative numbers also return the instruction rather than being written with “minus.” The supported upper limit is just under one trillion, matching the scale names included in the code.

Decimal numbers require a rule for how to speak the fractional part. A measurement might be read digit by digit after the decimal point, while a price is usually expressed in major and minor currency units. Those are different conventions, so a reliable decimal or currency function needs a clearly chosen format rather than a generic conversion assumption.

Excel’s regional settings can also affect how numbers are entered and displayed, but they do not change the English wording built into this code. The function uses US-style scale words and spelling. For another language, a different currency, or a convention such as inserting “and,” the word lists and grouping rules need to be adapted and checked carefully.

Currency amounts and check wording

For currency, do not treat the whole-number UDF as a complete check-writing solution. A check amount usually needs both major units and minor units, a defined rounding rule, and exact wording for zero cents or a fractional cent. For example, converting a value with binary floating-point precision can expose tiny representation differences around a half-cent boundary. A currency-specific function should first establish how the amount is rounded and which currency it represents.

For a simple report, a practical approach is to keep the numeric amount in one cell for calculations and use a separately designed text conversion for display. Confirm the output against the original amount before using it on a financial document. The example here is only a general English integer converter; it does not provide accounting, tax, legal, or bank-approved wording.

Alternatives to VBA

  • Power Query: It can reshape and transform imported data, but it does not provide a general built-in English number-to-words transformation. A custom M solution would still need carefully defined language and currency rules.
  • An Excel add-in: Some add-ins provide conversion functions. Check their source, supported versions, language, output conventions, and whether their formulas continue working for people who do not have the add-in.
  • A formula-only construction: It is possible to assemble lookup tables and text formulas for a tightly limited range, but the formula becomes difficult to maintain as number groups and edge cases are added. It is not a built-in Excel capability.
  • Manual or external conversion: For an occasional value, a trusted conversion tool or manual review may be simpler. Avoid sending sensitive amounts to an online service unless its privacy practices are suitable.

For repeated use in a controlled desktop workbook, a UDF is often straightforward. For files shared with users who cannot enable macros, choose a macro-free approach or distribute already-converted text with a clear process for keeping it synchronized with the numeric value.

Common problems and checks

  • #NAME? or an unrecognized function: Confirm that the code is in a standard module, the workbook is saved as .xlsm, and VBA macros are enabled. A formula copied to a workbook that does not contain the function will not know what NumberToWords means.
  • Text instruction instead of words: Check that the source is a nonnegative whole number and does not exceed the stated limit. Decimals and negatives are intentionally rejected.
  • Words do not update: Make sure the formula points to the intended cell and that calculation is not set to Manual. Press F9 to recalculate on Windows; on Mac, use Fn+F9 on keyboards where the function keys are assigned to hardware controls.
  • Unexpected language or punctuation: The code is specifically written for English with US-style wording. Changing Excel’s display language does not translate the VBA word lists.

If the function was recently changed but the displayed result seems stale, confirm that the workbook was saved and recalculated. Custom functions recalculate when their referenced cells change, but editing VBA code itself may require recalculation before the sheet shows the revised result.

Frequently Asked Questions

Is there an Excel formula to convert numbers to words?
There is no general built-in English number-to-words worksheet function in Excel. Add a VBA UDF such as NumberToWords, use a suitable add-in, or build a limited custom method for your specific needs.

Can I use NumberToWords in Excel for the web?
Excel for the web does not run VBA UDFs. Create and use this function in desktop Excel; for browser-only workflows, use a compatible add-in or another macro-free method.

Will the function spell out cents or decimal places?
No. The supplied code accepts whole numbers only and returns an instruction for decimals. Currency wording needs separate rules for rounding, major units, minor units, and the chosen currency.

Why does Excel show #NAME? for the formula?
Excel usually cannot find the custom function because the VBA code is missing, macros are disabled, or the formula is in a different workbook without the module. Check the file type, module, and security settings.

Can the same function convert negative numbers?
Not as written. It rejects values below zero so it does not guess whether to use “minus,” “negative,” or another convention. The code must be deliberately revised and tested if negative wording is required.

Related

Try it: the Column Letter to Number: aA is 27, XFD is 16,384. Converts both ways.

More in VBA & macros

Sources: Function behaviour and menu paths: Microsoft Support documentation for Excel. Method & sources

Spotted an error in this guide? Let us know.