How to convert numbers to words in Excel (with a ready-to-paste macro)
Excel has no function to spell out amounts. Here is a tested macro that gives you =AmountInWords(A1) for dollars, plus simpler ways to do it.
If you are looking for an Excel function that turns 1,250.50 into "one thousand two hundred fifty dollars and fifty cents", you won't find one: Excel has no built-in function to spell out numbers in English. The only one that exists, BAHTTEXT, does it in Thai.
Need it for your documents? If the amount in words is for invoices, receipts, contracts or cheques, in Documentemplate there is nothing to do: the function is already built in. Write
amountinwords(total)in the template and every document comes out with its amount in words, also when you generate them from your Excel spreadsheet. No macros, no.xlsmfiles.
If you want it inside Excel, there are three ways to get there, depending on what you need.
If you only need one amount: the converter
For a single invoice, receipt or cheque, the quickest option is the number to words converter: type the figure, pick the currency and the American or British style, and copy the text. Nothing to install.
If you need it in many cells: a macro
A small VBA macro gives you your own function, =AmountInWords(A1), which works like any other formula. Microsoft publishes a similar macro called SpellNumber in its support pages; this one follows the usual cheque style ("one hundred one", hyphens from twenty-one to ninety-nine) and handles singular and plural.
Step by step
- Open the workbook and press Alt + F11 to open the Visual Basic editor.
- In the menu, choose Insert → Module.
- Paste the code below and close the editor.
- In any cell, type
=AmountInWords(B2), whereB2holds the amount. - Save the file as an Excel Macro-Enabled Workbook (.xlsm); if you save it as
.xlsx, the macro is lost.
' =AmountInWords(A1) -> "one thousand two hundred fifty dollars and fifty cents"
' Amounts up to 999,999,999.99.
Function AmountInWords(ByVal amount As Double) As String
Dim dollars As Long, cents As Long, text As String
If amount < 0 Then
AmountInWords = "minus " & AmountInWords(-amount)
Exit Function
End If
If amount >= 1000000000 Then
AmountInWords = "Amount too large"
Exit Function
End If
dollars = Int(amount)
cents = Int((amount - dollars) * 100 + 0.5)
If cents = 100 Then
dollars = dollars + 1
cents = 0
End If
text = Words(dollars) & IIf(dollars = 1, " dollar", " dollars")
If cents > 0 Then text = text & " and " & Words(cents) & IIf(cents = 1, " cent", " cents")
AmountInWords = text
End Function
Private Function Words(ByVal n As Long) As String
Dim millions As Long, thousands As Long, rest As Long, text As String
If n = 0 Then
Words = "zero"
Exit Function
End If
millions = n \ 1000000
thousands = (n Mod 1000000) \ 1000
rest = n Mod 1000
If millions > 0 Then text = Hundreds(millions) & " million"
If thousands > 0 Then text = text & " " & Hundreds(thousands) & " thousand"
If rest > 0 Then text = text & " " & Hundreds(rest)
Words = Trim(text)
End Function
Private Function Hundreds(ByVal n As Long) As String
Dim ones As Variant, tens As Variant, text As String, r As Long
ones = Split("zero one two three four five six seven eight nine ten eleven twelve thirteen fourteen fifteen sixteen seventeen eighteen nineteen")
tens = Split("_ _ twenty thirty forty fifty sixty seventy eighty ninety")
If n >= 100 Then text = ones(n \ 100) & " hundred"
r = n Mod 100
If r > 0 Then
If r < 20 Then
text = text & " " & ones(r)
Else
text = text & " " & tens(r \ 10)
If r Mod 10 > 0 Then text = text & "-" & ones(r Mod 10)
End If
End If
Hundreds = Trim(text)
End Function
Tips
- In capital letters, as many people write cheques:
=UPPER(AmountInWords(B2)). - Round first if the cell comes from a calculation:
=AmountInWords(ROUND(B2,2)), so the cents match the figure you see. - Pounds or euros instead of dollars: change
" dollar"," dollars"," cent"and" cents". For pounds use "pound", "pounds", "penny" and "pence". - British style ("one hundred and one"): the macro follows the American style; the converter has both.
- Macros and security: Excel will ask you to enable content when you open the file. Macros don't run in Excel for the web or in Google Sheets.
Examples
| Figure | In words |
|---|---|
| 21.00 | twenty-one dollars |
| 101.00 | one hundred one dollars |
| 1,000,000.00 | one million dollars |
| 1,250.50 | one thousand two hundred fifty dollars and fifty cents |
| 0.01 | zero dollars and one cent |
The macro has been tested against the converter with thousands of figures and gives exactly the same words.
If the amount in words goes on documents you produce from Excel
If you spell out amounts because you then copy the Excel data into invoices, receipts or contracts, the macro only saves you half the work.
In Documentemplate the template writes the amount in words by itself, with the amountinwords(total) formula, and you can generate the documents straight from your spreadsheet: one PDF per row, each with its amount in figures and in words.
Try it for free
Stop writing the same document by hand
Design the template once in Documentemplate and generate each invoice, quote or report in seconds, with your letterhead and the calculations done for you.