Sometimes you need to convert the number into a text value. In that case, you can use the spell number function in Excel. Though it is not a built-in function in Excel, you can add it by using the VBA code. In VBA code, you can utilize the spell number function for currency function or without currency purpose also. In article will show you how to use the spell number in Excel effectively. We will show the proper explanation of the spell number function in the VBA code. I hope you find this article exciting.

## Download Practice Workbook

Download the practice workbook below.

## 2 Suitable Examples to Use Spell Number in Excel

As the spell number function is used to convert numbers into texts., you can use the spell number for two different purposes. One is for converting into the currency of several countries and the other is for a simple case. Both of the examples provide you with useful details through which you can have a proper overview of the spell number function.

### 1. Use Spell Number with Currency in Excel

Our first example is based on the use of the spell number with currency in Excel. In this example, we would like to create a VBA code with the spell number function. In this code, we will define the currency of several countries. So, when you use the spell number in a cell and define the country name, it will return the text form of that given currency. To have a proper understanding of the code, we will give an explanation of the code. If you want to open the Visual Basic window, you have to have the Developer tab on the ribbon. To show the developer tab on the ribbon, follow the link **How to Show the Developer Tab on the Ribbon**. Follow the steps carefully.

**Steps**

- First, go to the
**Developer**tab on the ribbon. - Then, select the
**Visual Basic**option from the**Code**group.

- It will open up the
**Visual Basic**window. - Then, go to the
**Insert**tab at the top. - After that, select the
**Module**option.

- As a result, a
**Module**code window will appear. - Write down the following code.

```
Option Explicit
Function SpellNumberX(ByVal MyNum, Optional MyCurr As String = "")
Dim Dllr, Cts, Temp
Dim DeciPlace, CountX
ReDim Place(9) As String
Place(2) = " Thousand "
Place(3) = " Million "
Place(4) = " Billion "
Place(5) = " Trillion "
MyNum = Trim(Str(MyNum))
DeciPlace = InStr(MyNum, ".")
If DeciPlace > 0 Then
Cts = GetTens(Left(Mid(MyNum, DeciPlace + 1) & _
"00", 2))
MyNum = Trim(Left(MyNum, DeciPlace - 1))
End If
CountX = 1
Do While MyNum <> ""
Temp = GetHundreds(Right(MyNum, 3))
If Temp <> "" Then Dllr = Temp & Place(CountX) & Dllr
If Len(MyNum) > 3 Then
MyNum = Left(MyNum, Len(MyNum) - 3)
Else
MyNum = ""
End If
CountX = CountX + 1
Loop
Dim str_amount, str_amounts
Dim str_cent, str_Cts
Select Case UCase(MyCurr)
Case "EU"
str_amount = "Euro"
str_amounts = "Euros"
str_cent = "Cent"
str_Cts = "Cents"
Case "CA"
str_amount = "Canadian Dollar"
str_amounts = "Canadian Dollars"
str_cent = "Cent"
str_Cts = "Cents"
Case "AU"
str_amount = "Australian Dollar"
str_amounts = "Australian Dollars"
str_cent = "Cent"
str_Cts = "Cents"
Case Else:
str_amount = "Dollar"
str_amounts = "Dollars"
str_cent = "Cent"
str_Cts = "Cents"
End Select
Select Case Dllr
Case ""
Dllr = "No " & str_amounts
Case "One"
Dllr = "One " & str_amount
Case Else
Dllr = Dllr & " " & str_amounts
End Select
Select Case Cts
Case ""
Cts = " and No " & str_Cts
Case "One"
Cts = " and One " & str_cent
Case Else
Cts = " and " & Cts & " " & str_Cts
End Select
SpellNumberX = Dllr & Cts
End Function
Function GetHundreds(ByVal MyNum)
Dim Result As String
If Val(MyNum) = 0 Then Exit Function
MyNum = Right("000" & MyNum, 3)
If Mid(MyNum, 1, 1) <> "0" Then
Result = GetDigit(Mid(MyNum, 1, 1)) & " Hundred "
End If
If Mid(MyNum, 2, 1) <> "0" Then
Result = Result & GetTens(Mid(MyNum, 2))
Else
Result = Result & GetDigit(Mid(MyNum, 3))
End If
GetHundreds = Result
End Function
Function GetTens(TensText)
Dim Result As String
Result = ""
If Val(Left(TensText, 1)) = 1 Then
Select Case Val(TensText)
Case 10: Result = "Ten"
Case 11: Result = "Eleven"
Case 12: Result = "Twelve"
Case 13: Result = "Thirteen"
Case 14: Result = "Fourteen"
Case 15: Result = "Fifteen"
Case 16: Result = "Sixteen"
Case 17: Result = "Seventeen"
Case 18: Result = "Eighteen"
Case 19: Result = "Nineteen"
Case Else
End Select
Else
Select Case Val(Left(TensText, 1))
Case 2: Result = "Twenty "
Case 3: Result = "Thirty "
Case 4: Result = "Forty "
Case 5: Result = "Fifty "
Case 6: Result = "Sixty "
Case 7: Result = "Seventy "
Case 8: Result = "Eighty "
Case 9: Result = "Ninety "
Case Else
End Select
Result = Result & GetDigit _
(Right(TensText, 1))
End If
GetTens = Result
End Function
Function GetDigit(Digit)
Select Case Val(Digit)
Case 1: GetDigit = "One"
Case 2: GetDigit = "Two"
Case 3: GetDigit = "Three"
Case 4: GetDigit = "Four"
Case 5: GetDigit = "Five"
Case 6: GetDigit = "Six"
Case 7: GetDigit = "Seven"
Case 8: GetDigit = "Eight"
Case 9: GetDigit = "Nine"
Case Else: GetDigit = ""
End Select
End Function
```

- Then, close the
**Visual Basic**

**Spell Number for Dollars **

First of all, we would like to show the spell number with currency for dollars. To do this, you need to follow the previous steps carefully. Then, follow the steps.

- First, select the cell where you want to use the spell number function.
- Then, write down the following formula.

`=SpellNumberX(B5)`

- Press
**Enter**to apply the formula.

- Then, drag the
**Fill Handle**icon down the column.

** **

**Spell Number for Euros**

Next, we would like to show the spell number with currency for Euros. Basically, we set the layout in the VBA code. We just need to define the Euros as ‘**EU**’. Then, follow the steps carefully.

- First, select the cell where you want to use the spell number function.
- Then, write down the following formula.

`=SpellNumberX(B5,"EU")`

- Press
**Enter**to apply the formula.

- Then, drag the
**Fill Handle**icon down the column.

**Spell Number for Australian Dollars**

Next, we would like to show the spell number with currency for Australian Dollars. Basically, we set the layout in the VBA code. We just need to define the Euros as ‘**AU**’. Then, follow the steps carefully.

- First, select the cell where you want to use the spell number function.
- Then, write down the following formula.

`=SpellNumberX(B5,"AU")`

- Press
**Enter**to apply the formula.

- Then, drag the
**Fill Handle**icon down the column.

** **

**Spell Number for Canadian Dollars**

Next, we would like to show the spell number with currency for Canadian Dollars. Basically, we set the layout in the VBA code. We just need to define the Euros as ‘**CA**’. Then, follow the steps carefully.

- First, select the cell where you want to use the spell number function.
- Then, write down the following formula.

`=SpellNumberX(B5,"CA")`

- Press
**Enter**to apply the formula.

- Then, drag the
**Fill Handle**icon down the column.

** **

**🔎 VBA Code Explanation:**

```
Option Explicit
Function SpellNumberX(ByVal MyNum, Optional MyCurr As String = "")
```

First of all, define the function name and also define the value of the function.

```
Dim Dllr, Cts, Temp
Dim DeciPlace, CountX
ReDim Place(9) As String
Place(2) = " Thousand "
Place(3) = " Million "
Place(4) = " Billion "
Place(5) = " Trillion "
```

Next, declare the necessary variable for the macro. The String is a representation of the amount.

` MyNum = Trim(Str(MyNum))`

Next, we trim the string value’s extra space.

`DeciPlace = InStr(MyNum, ".")`

After that, use the InStr function to find out the position of the sub-string within a string and set the position of the decimal place as 0 if none.

```
If DeciPlace > 0 Then
Cts = GetTens(Left(Mid(MyNum, DeciPlace + 1) & _
"00", 2))
MyNum = Trim(Left(MyNum, DeciPlace - 1))
End If
CountX = 1
```

Then, if the decimal place is greater than zero. Convert Cents and set Numbers to the dollar amount. If the criteria match then, set the countX as 1

```
Do While MyNum <> ""
Temp = GetHundreds(Right(MyNum, 3))
If Temp <> "" Then Dllr = Temp & Place(CountX) & Dllr
If Len(MyNum) > 3 Then
MyNum = Left(MyNum, Len(MyNum) - 3)
Else
MyNum = ""
End If
CountX = CountX + 1
Loop
```

Next, use the Do while loop, if the number is not blank. Then, check if the temp is not blank. After that, define the dollar. Again check if the number is greater than 3 then, define the number value. Otherwise, it will return a blank. If the loop works, then, add the 1 to the previous countX and finish the loop.

```
Dim str_amount, str_amounts
Dim str_cent, str_Cts
```

Next, declare the necessary variable for the macro.

```
Select Case UCase(MyCurr)
Case "EU"
str_amount = "Euro"
str_amounts = "Euros"
str_cent = "Cent"
str_Cts = "Cents"
```

Then, define the case for the Euro currency. Here, you can assign how it can be shown for a specific condition.

```
Case "CA"
str_amount = "Canadian Dollar"
str_amounts = "Canadian Dollars"
str_cent = "Cent"
str_Cts = "Cents"
```

Then, define the case for the Canadian currency. Here, you can assign how it can be shown for a specific condition.

```
Case "AU"
str_amount = "Australian Dollar"
str_amounts = "Australian Dollars"
str_cent = "Cent"
str_Cts = "Cents"
```

Then, define the case for the Australian currency. Here, you can assign how it can be shown for a specific condition.

```
Case Else:
str_amount = "Dollar"
str_amounts = "Dollars"
str_cent = "Cent"
str_Cts = "Cents"
End Select
```

Besides those three cases, if you use the value in the spell number function, it will return the dollar currency. Then, end the selection.

```
Select Case Dllr
Case ""
Dllr = "No " & str_amounts
Case "One"
Dllr = "One " & str_amount
Case Else
Dllr = Dllr & " " & str_amounts
End Select
```

After that, select the dollar case. If the case is blank, then it will return No. For case one, it returns one dollar. Otherwise, it will return the dollar amounts.

```
Select Case Cts
Case ""
Cts = " and No " & str_Cts
Case "One"
Cts = " and One " & str_cent
Case Else
Cts = " and " & Cts & " " & str_Cts
End Select
```

For cents case, if the case is blank, then it will return No. For case one, it returns one dollar. Otherwise, it will return the cents amounts.

```
SpellNumberX = Dllr & Cts
End Function
```

Finally, when you use the spell function and define the numbered cell, it will return the value of both dollars and cents.

`Function GetHundreds(ByVal MyNum)`

Then, we define the function GetHundreds.

`Dim Result As String`

Next, declare the necessary variable for the macro.

```
If Val(MyNum) = 0 Then Exit Function
MyNum = Right("000" & MyNum, 3)
```

If the val function returns a zero number from the string, then the function will end.

```
If Mid(MyNum, 1, 1) <> "0" Then
Result = GetDigit(Mid(MyNum, 1, 1)) & " Hundred "
End If
```

The mid function returns a specific number of characters from the string. Here, the mid function extracts the first character. If this is not equal to zero or not. Then, define the result for it.

```
If Mid(MyNum, 2, 1) <> "0" Then
Result = Result & GetTens(Mid(MyNum, 2))
Else
Result = Result & GetDigit(Mid(MyNum, 3))
End If
```

Then, take the mid function and it starts from 2nd place and finishes after one character. Now, check if that is not equal to zero or not. Then, define the result with GetTens. Otherwise, it takes results using GetDigit.

```
GetHundreds = Result
End Function
```

Next, the GetHundreds take the result. After that, end the function.

`Function GetTens(TensText)`

Then, define the function GetTens for the macro.

`Dim Result As String`

Next, declare the necessary variable for the macro.

`Result = ""`

Define the result as null out of the temporary function value

```
If Val(Left(TensText, 1)) = 1 Then
Select Case Val(TensText)
Case 10: Result = "Ten"
Case 11: Result = "Eleven"
Case 12: Result = "Twelve"
Case 13: Result = "Thirteen"
Case 14: Result = "Fourteen"
Case 15: Result = "Fifteen"
Case 16: Result = "Sixteen"
Case 17: Result = "Seventeen"
Case 18: Result = "Eighteen"
Case 19: Result = "Nineteen"
Case Else
End Select
```

Next, set the if condition. First, the left function returns the first character from the tensText. After that, Val function takes that return value and returns the number that contains in that string. Finally, check if the number is equal to 1. If it meets the criterion, then, returns the defined case result. Finally, end the process.

```
Else
Select Case Val(Left(TensText, 1))
Case 2: Result = "Twenty "
Case 3: Result = "Thirty "
Case 4: Result = "Forty "
Case 5: Result = "Fifty "
Case 6: Result = "Sixty "
Case 7: Result = "Seventy "
Case 8: Result = "Eighty "
Case 9: Result = "Ninety "
Case Else
End Select
```

Otherwise, If the value is between 20-99, It also goes to the case using the val and left function. Then, returns the defined case result. Finally, end the process.

```
Result = Result & GetDigit _
(Right(TensText, 1))
End If
GetTens = Result
End Function
```

Then, define the result with GetDigit. Next, using the Right function retrieves ones place. Finally, end the function.

`Function GetDigit(Digit)`

To convert a number from 1 to 9 into text. Define the GetDigit function of the macro.

```
Select Case Val(Digit)
Case 1: GetDigit = "One"
Case 2: GetDigit = "Two"
Case 3: GetDigit = "Three"
Case 4: GetDigit = "Four"
Case 5: GetDigit = "Five"
Case 6: GetDigit = "Six"
Case 7: GetDigit = "Seven"
Case 8: GetDigit = "Eight"
Case 9: GetDigit = "Nine"
Case Else: GetDigit = ""
End Select
```

Then, select the case using the Val function. It returns numbers that contain in a string. Then, check which case is applicable for that. Otherwise, returns as blank. Then, end the selection.

`End Function`

Finally, end the function of the macro

**Read More:**** [Solved] Spell Number Not Working in Excel**

### 2. Use Spell Number Without Currency in Excel

Our first example is based on the use of the **spell number without currency in Excel.** In this example, we would like to create a VBA code with the spell number function. We want to convert numbers into texts. In that case, the currency will be neglected. To get a proper understanding of the code, we will give an explanation of the code. Follow the steps properly.

**Steps**

- First, go to the
**Developer**tab on the ribbon. - Then, select the
**Visual Basic**option from the**Code**group.

- It will open up the
**Visual Basic**window. - Then, go to the
**Insert**tab at the top. - After that, select the
**Module**option.

- As a result, a
**Module**code window will appear. - Write down the following code.

```
Option Explicit
Function SpellNumberY(ByVal MyNum)
Dim Dllr, Cts, Temp
Dim DeciPlace, CountX
ReDim Place(9) As String
Place(2) = " Thousand "
Place(3) = " Million "
Place(4) = " Billion "
Place(5) = " Trillion "
MyNum = Trim(Str(MyNum))
DeciPlace = InStr(MyNum, ".")
If DeciPlace > 0 Then
Cts = GetDigit(Left(Mid(MyNum, DeciPlace + 1) & _
"00", 1)) & " " & GetDigit(Left(Mid(MyNum, DeciPlace + 2) & _
"00", 1))
MyNum = Trim(Left(MyNum, DeciPlace - 1))
End If
CountX = 1
Do While MyNum <> ""
Temp = GetHundreds(Right(MyNum, 3))
If Temp <> "" Then Dllr = Temp & Place(CountX) & Dllr
If Len(MyNum) > 3 Then
MyNum = Left(MyNum, Len(MyNum) - 3)
Else
MyNum = ""
End If
CountX = CountX + 1
Loop
Select Case Cts
Case ""
Cts = ""
Case "One"
Cts = " Point One "
Case Else
Cts = " Point " & Cts & " "
End Select
SpellNumberY = Dllr & Cts
End Function
Function GetHundreds(ByVal MyNum)
Dim Result As String
If Val(MyNum) = 0 Then Exit Function
MyNum = Right("000" & MyNum, 3)
If Mid(MyNum, 1, 1) <> "0" Then
Result = GetDigit(Mid(MyNum, 1, 1)) & " Hundred "
End If
If Mid(MyNum, 2, 1) <> "0" Then
Result = Result & GetTens(Mid(MyNum, 2))
Else
Result = Result & GetDigit(Mid(MyNum, 3))
End If
GetHundreds = Result
End Function
Function GetTens(TensText)
Dim Result As String
Result = ""
If Val(Left(TensText, 1)) = 1 Then
Select Case Val(TensText)
Case 10: Result = "Ten"
Case 11: Result = "Eleven"
Case 12: Result = "Twelve"
Case 13: Result = "Thirteen"
Case 14: Result = "Fourteen"
Case 15: Result = "Fifteen"
Case 16: Result = "Sixteen"
Case 17: Result = "Seventeen"
Case 18: Result = "Eighteen"
Case 19: Result = "Nineteen"
Case Else
End Select
Else
Select Case Val(Left(TensText, 1))
Case 2: Result = "Twenty "
Case 3: Result = "Thirty "
Case 4: Result = "Forty "
Case 5: Result = "Fifty "
Case 6: Result = "Sixty "
Case 7: Result = "Seventy "
Case 8: Result = "Eighty "
Case 9: Result = "Ninety "
Case Else
End Select
Result = Result & GetDigit _
(Right(TensText, 1))
End If
GetTens = Result
End Function
Function GetDigit(Digit)
Select Case Val(Digit)
Case 1: GetDigit = "One"
Case 2: GetDigit = "Two"
Case 3: GetDigit = "Three"
Case 4: GetDigit = "Four"
Case 5: GetDigit = "Five"
Case 6: GetDigit = "Six"
Case 7: GetDigit = "Seven"
Case 8: GetDigit = "Eight"
Case 9: GetDigit = "Nine"
Case Else: GetDigit = ""
End Select
End Function
```

- Then, close the
**Visual Basic**window. - After that, select the cell where you want to use the spell number function.
- Then, write down the following formula.

`=SpellNumberY(B5)`

- Press
**Enter**to apply the formula.

- Then, drag the
**Fill Handle**icon down the column.

**🔎 VBA Code Explanation:**

```
Option Explicit
Function SpellNumberY(ByVal MyNum)
```

First of all, define the function name and also define the value of the function.

```
Dim Dllr, Cts, Temp
Dim DeciPlace, CountX
ReDim Place(9) As String
Place(2) = " Thousand "
Place(3) = " Million "
Place(4) = " Billion "
Place(5) = " Trillion "
```

Next, declare the necessary variable for the macro. The String is a representation of the amount.

`MyNum = Trim(Str(MyNum))`

Next, we trim the string value’s extra space.

`DeciPlace = InStr(MyNum, ".")`

After that, use the InStr function to find out the position of the sub-string within a string and set the position of the decimal place as 0 if none.

```
If DeciPlace > 0 Then
Cts = GetDigit(Left(Mid(MyNum, DeciPlace + 1) & _
"00", 1)) & " " & GetDigit(Left(Mid(MyNum, DeciPlace + 2) & _
"00", 1))
MyNum = Trim(Left(MyNum, DeciPlace - 1))
End If
CountX = 1
```

Then, if the decimal place is greater than zero. Convert Cents and set Numbers to the dollar amount. If the criteria match then, set the countX as 1.

```
Do While MyNum <> ""
Temp = GetHundreds(Right(MyNum, 3))
If Temp <> "" Then Dllr = Temp & Place(CountX) & Dllr
If Len(MyNum) > 3 Then
MyNum = Left(MyNum, Len(MyNum) - 3)
Else
MyNum = ""
End If
CountX = CountX + 1
Loop
```

Next, use the Do while loop, if the number is not blank. Then, check if the temp is not blank. After that, define the dollar. Again check if the number is greater than 3 then, define the number value. Otherwise, it will return a blank. If the loop works, then, add the 1 to the previous countX and finish the loop.

```
Select Case Cts
Case ""
Cts = ""
Case "One"
Cts = " Point One "
Case Else
Cts = " Point " & Cts & " "
End Select
```

For cents case, if the case is blank, then it will return cents as blank. For case one, it returns cents as point one. Otherwise, it will return the cents amounts.

```
SpellNumberY = Dllr & Cts
End Function
```

Finally, when you use the spell function and define the numbered cell, it will return the value of both dollars and cents.

`Function GetHundreds(ByVal MyNum)`

To Convert a number from 100-999 into text, define the function of the macro.

`Dim Result As String`

Next, declare the necessary variable for the macro.

```
If Val(MyNum) = 0 Then Exit Function
MyNum = Right("000" & MyNum, 3)
```

If the val function returns a zero number from the string, then the function will end.

```
If Mid(MyNum, 1, 1) <> "0" Then
Result = GetDigit(Mid(MyNum, 1, 1)) & " Hundred "
End If
```

The mid function returns a specific number of characters from the string. Here, the mid function extracts the first character. If this is not equal to zero or not. Then, define the result to convert the hundreds place.

```
If Mid(MyNum, 2, 1) <> "0" Then
Result = Result & GetTens(Mid(MyNum, 2))
Else
Result = Result & GetDigit(Mid(MyNum, 3))
End If
```

Then, take the mid function and it starts from 2nd place and finishes after one character. Now, check if that is not equal to zero or not. Then, define the result with GetTens to convert the tens place. Otherwise, it takes results using GetDigit to convert the one’s place.

```
GetHundreds = Result
End Function
```

Next, the GetHundreds take the result. After that, ends the function.

`Function GetTens(TensText)`

To convert a number from 10 to 99 into text, define the function of the macro.

`Dim Result As String`

Next, declare the necessary variable for the macro.

`Result = ""`

Define the result as null out of the temporary function value

```
If Val(Left(TensText, 1)) = 1 Then
Select Case Val(TensText)
Case 10: Result = "Ten"
Case 11: Result = "Eleven"
Case 12: Result = "Twelve"
Case 13: Result = "Thirteen"
Case 14: Result = "Fourteen"
Case 15: Result = "Fifteen"
Case 16: Result = "Sixteen"
Case 17: Result = "Seventeen
Case 18: Result = "Eighteen"
Case 19: Result = "Nineteen"
Case Else
End Select
```

Next, set the if condition. First, the left function returns the first character from the tensText. After that, Val function takes that return value and returns the number that contains in that string. Finally, check if the number is equal to 1. If it meets the criterion, then, returns the defined case result. Finally, end the process.

```
Else
Select Case Val(Left(TensText, 1))
Case 2: Result = "Twenty "
Case 3: Result = "Thirty "
Case 4: Result = "Forty "
Case 5: Result = "Fifty "
Case 6: Result = "Sixty "
Case 7: Result = "Seventy "
Case 8: Result = "Eighty "
Case 9: Result = "Ninety "
Case Else
End Select
```

Otherwise, If the value is between 20-99, It also goes to the case using the val and left function. Then, returns the defined case result. Finally, end the process.

```
Result = Result & GetDigit _
(Right(TensText, 1))
End If
GetTens = Result
End Function
```

Then, define the result with GetDigit. Next, using the Right function retrieves the ones place. Finally, end the function.

`Function GetDigit(Digit)`

To convert a number from 1 to 9 into text. Define the GetDigit function of the macro.

```
Select Case Val(Digit)
Case 1: GetDigit = "One"
Case 2: GetDigit = "Two"
Case 3: GetDigit = "Three"
Case 4: GetDigit = "Four"
Case 5: GetDigit = "Five"
Case 6: GetDigit = "Six"
Case 7: GetDigit = "Seven"
Case 8: GetDigit = "Eight"
Case 9: GetDigit = "Nine"
Case Else: GetDigit = ""
End Select
```

Then, select the case using the Val function. It returns numbers that contain in a string. Then, check which case is applicable for that. Otherwise, returns as blank. Then, end the selection.

`End Function`

Finally, end the function of the macro

**Read More:** **How to Spell Number in Taka in Excel (With Easy Steps)**

## Conclusion

We have shown two different examples to use the spell number in Excel including with currency and without currency. Both of the examples provide a complete guideline on how to use the spell number in Excel. I hope we covered all possible areas on this topic. If you have any more questions, feel free to ask in the comment box. Don’t forget to visit our **Exceldemy** page.