This guide will use the following dataset:
Step 1: Build a Formula to Convert From Numbers to Words
The following formula is huge but it give you the expected output:
=IF(OR(LEN(FLOOR(B5,1))=13,FLOOR(B5,1)<=0),"Out of range",PROPER(SUBSTITUTE(CONCATENATE(CHOOSE(MID(TEXT(INT(B5),REPT(0,12)),1,1)+1,"","one hundred ","two hundred ","three hundred ","four hundred ","five hundred ","six hundred ","seven hundred ","eight hundred ","nine hundred "),CHOOSE(MID(TEXT(INT(B5),REPT(0,12)),2,1)+1,"",CHOOSE(MID(TEXT(INT(B5),REPT(0,12)),3,1)+1,"ten","eleven","twelve","thirteen","fourteen","fifteen","sixteen","seventeen","eighteen","nineteen"),"twenty","thirty","forty","fifty","sixty","seventy","eighty","ninety"),IF(VALUE(MID(TEXT(INT(B5),REPT(0,12)),2,1))>1,CHOOSE(MID(TEXT(INT(B5),REPT(0,12)),3,1)+1,""," one"," two"," three"," four"," five"," six"," seven"," eight"," nine"),IF(VALUE(MID(TEXT(INT(B5),REPT(0,12)),2,1))=0,CHOOSE(MID(TEXT(INT(B5),REPT(0,12)),3,1)+1,"","one","two","three","four","five","six","seven","eight","nine"),"")),IF(B5>=10^9," billion ",""),CHOOSE(MID(TEXT(INT(B5),REPT(0,12)),4,1)+1,"","one hundred ","two hundred ","three hundred ","four hundred ","five hundred ","six hundred ","seven hundred ","eight hundred ","nine hundred "),CHOOSE(MID(TEXT(INT(B5),REPT(0,12)),5,1)+1,"",CHOOSE(MID(TEXT(INT(B5),REPT(0,12)),6,1)+1,"ten","eleven","twelve","thirteen","fourteen","fifteen","sixteen","seventeen","eighteen","nineteen"),"twenty","thirty","forty","fifty","sixty","seventy","eighty","ninety"),IF(VALUE(MID(TEXT(INT(B5),REPT(0,12)),5,1))>1,CHOOSE(MID(TEXT(INT(B5),REPT(0,12)),6,1)+1,""," one"," two"," three"," four"," five"," six"," seven"," eight"," nine"),IF(VALUE(MID(TEXT(INT(B5),REPT(0,12)),5,1))=0,CHOOSE(MID(TEXT(INT(B5),REPT(0,12)),6,1)+1,"","one","two","three","four","five","six","seven","eight","nine"),"")),IF(VALUE(MID(TEXT(INT(B5),REPT(0,12)),4,3))>0," million ",""),CHOOSE(MID(TEXT(INT(B5),REPT(0,12)),7,1)+1,"","one hundred ","two hundred ","three hundred ","four hundred ","five hundred ","six hundred ","seven hundred ","eight hundred ","nine hundred "),CHOOSE(MID(TEXT(INT(B5),REPT(0,12)),8,1)+1,"",CHOOSE(MID(TEXT(INT(B5),REPT(0,12)),9,1)+1,"ten","eleven","twelve","thirteen","fourteen","fifteen","sixteen","seventeen","eighteen","nineteen"),"twenty","thirty","forty","fifty","sixty","seventy","eighty","ninety"),IF(VALUE(MID(TEXT(INT(B5),REPT(0,12)),8,1))>1,CHOOSE(MID(TEXT(INT(B5),REPT(0,12)),9,1)+1,""," one"," two"," three"," four"," five"," six"," seven"," eight"," nine"),IF(VALUE(MID(TEXT(INT(B5),REPT(0,12)),8,1))=0,CHOOSE(MID(TEXT(INT(B5),REPT(0,12)),9,1)+1,"","one","two","three","four","five","six","seven","eight","nine"),"")),IF(VALUE(MID(TEXT(INT(B5),REPT(0,12)),7,3))," thousand ",""),CHOOSE(MID(TEXT(INT(B5),REPT(0,12)),10,1)+1,"","one hundred ","two hundred ","three hundred ","four hundred ","five hundred ","six hundred ","seven hundred ","eight hundred ","nine hundred "),CHOOSE(MID(TEXT(INT(B5),REPT(0,12)),11,1)+1,"",CHOOSE(MID(TEXT(INT(B5),REPT(0,12)),12,1)+1,"ten","eleven","twelve","thirteen","fourteen","fifteen","sixteen","seventeen","eighteen","nineteen"),"twenty","thirty","forty","fifty","sixty","seventy","eighty","ninety"),IF(VALUE(MID(TEXT(INT(B5),REPT(0,12)),11,1))>1,CHOOSE(MID(TEXT(INT(B5),REPT(0,12)),12,1)+1,""," one"," two"," three"," four"," five"," six"," seven"," eight"," nine"),IF(VALUE(MID(TEXT(INT(B5),REPT(0,12)),11,1))=0,CHOOSE(MID(TEXT(INT(B5),REPT(0,12)),12,1)+1,"","one","two","three","four","five","six","seven","eight","nine"),"")))," "," ")&IF(FLOOR(B5,1)>1," "," "))&IF(ISERROR(FIND(".",B5,1)),""," point "&PROPER(IF(LEN(LEFT(TRIM(MID(SUBSTITUTE(B5,".",REPT(" ",255)),255,200)),2))=1,CHOOSE(1*LEFT(TRIM(MID(SUBSTITUTE(B5,".",REPT(" ",255)),255,200)),2),"One","Two","Three","Four","Five","Six","Seven","Eight","Nine")&" ","")&CONCATENATE(CHOOSE(MID(TEXT(INT(LEFT(TRIM(MID(SUBSTITUTE(B5,".",REPT(" ",255)),255,200)),2)),REPT(0,12)),11,1)+1,"",CHOOSE(MID(TEXT(INT(LEFT(TRIM(MID(SUBSTITUTE(B5,".",REPT(" ",255)),255,200)),2)),REPT(0,12)),12,1)+1,"One","One One","One Two","One Three","One Four","One Five","One Six","One Seven","One Eight","One Nine")&" ","Two","Three","Four","Five","Six","Seven","Eight","Nine"),IF(VALUE(MID(TEXT(INT(LEFT(TRIM(MID(SUBSTITUTE(B5,".",REPT(" ",255)),255,200)),2)),REPT(0,12)),11,1))>1,CHOOSE(MID(TEXT(INT(LEFT(TRIM(MID(SUBSTITUTE(B5,".",REPT(" ",255)),255,200)),2)),REPT(0,12)),12,1)+1,""," One"," Two"," Three"," Four"," Five"," Six"," Seven"," Eight"," Nine")&" ",IF(LEFT(TRIM(MID(SUBSTITUTE(B5,".",REPT(" ",255)),255,200)),2)="01","one ",IF(LEFT(TRIM(MID(SUBSTITUTE(B5,".",REPT(" ",255)),255,200)),1)="0",CHOOSE(MID(TEXT(INT(LEFT(TRIM(MID(SUBSTITUTE(B5,".",REPT(" ",255)),255,200)),2)),REPT(0,12)),12,1)+1,"","One","Two","Three","Four","Five","Six","Seven","Eight","Nine")&" ","")))))))
Read More: How to Use Spell Number in Excel
Step 2: Apply the Formula to Excel
- Select the cell where you want the converted word to appear. In this guide, the cell in question is C5.
- Copy the entire formula and paste it into the C5 cell.
- Press Enter to receive the converted word output of the adjacent B5 cell’s numeric value.
- Select cell C5 and drag the Fill Handle to the bottom where the numbers end.
- You should see the following result:
How Does the Formula Work?
The formula has four key functions:
- LEFT Function
- TEXT Function
- MID Function
- CHOOSE Function
The goal of the LEFT function is to select a predetermined number of characters from the left side of the text. The LEFT function is organized as follows:
LEFT(text, [num_chars]):
The Text parameter is the cell that has the input, and [num_chars] is the number of characters to pull out. Since the [num_chars] parameter is optional, the program will draw just one character by default if you don’t use it.
The main purpose of the TEXT function is to put information about a cell in a certain way. Here’s how the TEXT function is put together.
TEXT(value, format_text):
Most of the time, you use common cell formatting controls to change how a cell looks. The TEXT sticks to the format of the letter. This way, the information can be formatted in a manner that changes based on your needs and the situation.
The goal of the MID function is to pull a certain number of characters from a certain character position on the left side of the text. This is how the MID function is put together.
MID(text, start_num, num_chars):
The input cell is named Text. The start_num argument informs the software where to start drawing text. The num_chars specify how many characters to draw.
The CHOOSE function makes it easier to check the same set of data with many nested IF functions. This function is very useful when working with indexes. The goal of the CHOOSE function is to pick a value from a list of built-in values based on an integer that you give it. So, this is how the CHOOSE function is put together.
CHOOSE(index_num, value1, [value2], …):
How to Convert Numbers to Words in Excel With VBA
Steps:
- Go to the Developer tab and click on the Visual Basic button.
- Click on Insert and select the Module option.
- Copy the following code and paste it into the window:
Function SpellNumber(ByVal MyNumber)
Dim uStr As String
Dim uFNum As Integer
Dim uStrPoint
Dim uStrNumber
Dim uPoint As String
Dim uNumber As String
Dim uP() As Variant
Dim uDP
Dim uCnt As Integer
Dim uResult, uT As String
Dim uLen As Integer
On Error Resume Next
uP = Array("", "Thousand ", "Million ", "Billion ", "Trillion ", " ", " ", " ", " ")
uNumber = Trim(Str(MyNumber))
uDP = InStr(uNumber, ".")
uPoint = ""
uStrNumber = ""
If uDP > 0 Then
uPoint = " point "
uStr = Mid(uNumber, uDP + 1)
uStrPoint = Left(uStr, Len(uNumber) - uDP)
For uFNum = 1 To Len(uStrPoint)
uStr = Mid(uStrPoint, uFNum, 1)
uPoint = uPoint & Digits(uStr) & " "
Next uFNum
uNumber = Trim(Left(uNumber, uDP - 1))
End If
uCnt = 0
uResult = ""
uT = ""
uLen = 0
uLen = Int(Len(Str(uNumber)) / 3)
If (Len(Str(uNumber)) Mod 3) = 0 Then uLen = uLen - 1
Do While uNumber <> ""
If uLen = uCnt Then
uT = HundredsDigits(Right(uNumber, 3), False)
Else
If uCnt = 0 Then
uT = HundredsDigits(Right(uNumber, 3), True)
Else
uT = HundredsDigits(Right(uNumber, 3), False)
End If
End If
If uT <> "" Then
uResult = uT & uP(uCnt) & uResult
End If
If Len(uNumber) > 3 Then
uNumber = Left(uNumber, Len(uNumber) - 3)
Else
uNumber = ""
End If
uCnt = uCnt + 1
Loop
uResult = uResult & uPoint
SpellNumber = uResult
End Function
Function HundredsDigits(uHDgt, uB As Boolean)
Dim uRStr As String
Dim uStrNum As String
Dim uStr As String
Dim uI As Integer
Dim uBB As Boolean
uStrNum = uHDgt
uRStr = ""
On Error Resume Next
uBB = True
If Val(uStrNum) = 0 Then Exit Function
uStrNum = Right("000" & uStrNum, 3)
uStr = Mid(uStrNum, 1, 1)
If uStr <> "0" Then
uRStr = Digits(Mid(uStrNum, 1, 1)) & "Hundred "
Else
If uB Then
uRStr = "and "
uBB = False
Else
uRStr = " "
uBB = False
End If
End If
If Mid(uStrNum, 2, 2) <> "00" Then
uRStr = uRStr & TenDigits(Mid(uStrNum, 2, 2), uBB)
End If
HundredsDigits = uRStr
End Function
Function TenDigits(uTDgt, uB As Boolean)
Dim uStr As String
Dim uI As Integer
Dim uArr_1() As Variant
Dim uArr_2() As Variant
Dim uT As Boolean
uArr_1 = Array("Ten ", "Eleven ", "Twelve ", "Thirteen ", "Fourteen ", "Fifteen ", "Sixteen ", "Seventeen ", "Eighteen ", "Nineteen ")
uArr_2 = Array("", "", "Twenty ", "Thirty ", "Forty ", "Fifty ", "Sixty ", "Seventy ", "Eighty ", "Ninety ")
uStr = ""
uT = True
On Error Resume Next
If Val(Left(uTDgt, 1)) = 1 Then
uI = Val(Right(uTDgt, 1))
If uB Then uStr = "and "
uStr = uStr & uArr_1(uI)
Else
uI = Val(Left(uTDgt, 1))
If Val(Left(uTDgt, 1)) > 1 Then
If uB Then uStr = "and "
uStr = uStr & uArr_2(Val(Left(uTDgt, 1)))
uT = False
End If
If uStr = "" Then
If uB Then
uStr = "and "
End If
End If
If Right(uTDgt, 1) <> "0" Then
uStr = uStr & Digits(Right(uTDgt, 1))
End If
End If
TenDigits = uStr
End Function
Function Digits(uDgt)
Dim uStr As String
Dim uArr_1() As Variant
uArr_1 = Array("Zero ", "One ", "Two ", "Three ", "Four ", "Five ", "Six ", "Seven ", "Eight ", "Nine ")
uStr = ""
On Error Resume Next
uStr = uArr_1(Val(uDgt))
Digits = uStr
End Function
- Save the file as a macro-enabled Excel file with the xlsm extension.
- Select cell C5 and write ‘=SpellNumber(B5)’. B5 is where the numeric data is.
- Press Enter to get the converted version of the number.
- Drag the Fill Handle from C5 to C13 to convert all cells.
Things to Remember
- When practicing, change the cell value of the formula. Each cell value should be replaced with a cell of your choosing.
- The formula can only show output up to two decimal places.
- For higher decimal places, you need to go with the VBA method.
Download Practice Workbook
Related Articles
- How to Convert Number to Words in Excel
- How to Spell Number in Taka in Excel
- How to Spell Number in Dirhams in Excel
- [Solved] Spell Number Not Working in Excel
- How to Convert Peso Number to Words in Excel
- How to Convert Number to Words in Excel in Rupees
- How to Spell Number Without Currency in Excel
<< Go Back to Spell Number in Excel | Convert Number to Text | Learn Excel
Get FREE Advanced Excel Exercises with Solutions!