How to Convert Number to Words in Excel (4 Suitable Ways)

Spreadsheets are used by many people in their daily jobs, making them an important element of their office. While the majority of people use spreadsheets in a reasonably basic manner, some advanced users find it difficult or complicated to convert number to words in Excel. In this guide, we have addressed this issue and provided four different methods to convert number to words in Excel. Furthermore, there are three more methods for converting numbers into text formats.


Watch Video – Convert Numbers to Words in Excel



How to Convert Number to Words in Excel: 4 Suitable Ways

This section of the article explains how to convert numbers to words in Excel. Moreover, we’re going to demonstrate four techniques to perform the operation. For conducting the session, we’re going to use Microsoft 365 version.


1. Use of Combined Functions in Excel to Convert Number to Words

The Excel formula that we used here relies on four functions. The LEFT, MID, TEXT, and CHOOSE functions.

Firstly, the syntax of the LEFT function is as follows:

Basically, this function is used to extract characters from text.

=LEFT (text, [num_chars])

Text: The text string to extract the characters from.

num_chars [Optional]: The number of characters to extract. It starts from the left. By default, num_chars=1.

Secondly, the syntax of the MID function is as follows:

Actually, this function is used to extract text from inside a string.

=MID (text, start_num, num_chars)

Text: The text to extract from.

start_num: The location of the first character to extract.

num_chars: The number of characters to extract.

Thirdly, the syntax of the TEXT function is as follows:

Eventually, this function converts a number into a text in number format.

=TEXT (value, format_text)

value: The number to convert.

format_text: The number format to use.

Next, the syntax of the CHOOSE function is as follows:

This function gets a value from a list based on position.

=CHOOSE (index_num, value1, [value2], …)

index_num: The value to choose. A number between 1 and 254.

value1: The first value from which to choose.

value2 [optional]: The second value from which to choose.

  • Here, we will convert the number in the Numbers in Words column.

use of combined functions to convert number to words in Excel

  • Now, write down the following formula in the C5 cell:
    =CHOOSE(LEFT(TEXT(B5,"000000000.00"))+1,,"One","Two","Three","Four","Five","Six","Seven","Eight","Nine") &IF(--LEFT(TEXT(B5,"000000000.00"))=0,,IF(AND(--MID(TEXT(B5,"000000000.00"),2,1)=0,--MID(TEXT(B5,"000000000.00"),3,1)=0)," Hundred"," Hundred and ")) &CHOOSE(MID(TEXT(B5,"000000000.00"),2,1)+1,,,"Twenty ","Thirty ","Forty ","Fifty ","Sixty ","Seventy ","Eighty ","Ninety ") &IF(--MID(TEXT(B5,"000000000.00"),2,1)<>1,CHOOSE(MID(TEXT(B5,"000000000.00"),3,1)+1,,"One","Two","Three","Four","Five","Six","Seven","Eight","Nine"), CHOOSE(MID(TEXT(B5,"000000000.00"),3,1)+1,"Ten","Eleven","Twelve","Thirteen","Fourteen","Fifteen","Sixteen","Seventeen","Eighteen","Nineteen")) &IF((--LEFT(TEXT(B5,"000000000.00"))+MID(TEXT(B5,"000000000.00"),2,1)+MID(TEXT(B5,"000000000.00"),3,1))=0,,IF(AND((--MID(TEXT(B5,"000000000.00"),4,1)+MID(TEXT(B5,"000000000.00"),5,1)+MID(TEXT(B5,"000000000.00"),6,1)+MID(TEXT(B5,"000000000.00"),7,1))=0,(--MID(TEXT(B5,"000000000.00"),8,1)+RIGHT(TEXT(B5,"000000000.00")))>0)," Million and "," Million ")) &CHOOSE(MID(TEXT(B5,"000000000.00"),4,1)+1,,"One","Two","Three","Four","Five","Six","Seven","Eight","Nine") &IF(--MID(TEXT(B5,"000000000.00"),4,1)=0,,IF(AND(--MID(TEXT(B5,"000000000.00"),5,1)=0,--MID(TEXT(B5,"000000000.00"),6,1)=0)," Hundred"," Hundred and")) &CHOOSE(MID(TEXT(B5,"000000000.00"),5,1)+1,,," Twenty"," Thirty"," Forty"," Fifty"," Sixty"," Seventy"," Eighty"," Ninety") &IF(--MID(TEXT(B5,"000000000.00"),5,1)<>1,CHOOSE(MID(TEXT(B5,"000000000.00"),6,1)+1,," One"," Two"," Three"," Four"," Five"," Six"," Seven"," Eight"," Nine"),CHOOSE(MID(TEXT(B5,"000000000.00"),6,1)+1," Ten"," Eleven"," Twelve"," Thirteen"," Fourteen"," Fifteen"," Sixteen"," Seventeen"," Eighteen"," Nineteen")) &IF((--MID(TEXT(B5,"000000000.00"),4,1)+MID(TEXT(B5,"000000000.00"),5,1)+MID(TEXT(B5,"000000000.00"),6,1))=0,,IF(OR((--MID(TEXT(B5,"000000000.00"),7,1)+MID(TEXT(B5,"000000000.00"),8,1)+MID(TEXT(B5,"000000000.00"),9,1))=0,--MID(TEXT(B5,"000000000.00"),7,1)<>0)," Thousand "," Thousand and ")) &CHOOSE(MID(TEXT(B5,"000000000.00"),7,1)+1,,"One","Two","Three","Four","Five","Six","Seven","Eight","Nine") &IF(--MID(TEXT(B5,"000000000.00"),7,1)=0,,IF(AND(--MID(TEXT(B5,"000000000.00"),8,1)=0,--MID(TEXT(B5,"000000000.00"),9,1)=0)," Hundred "," Hundred and "))& CHOOSE(MID(TEXT(B5,"000000000.00"),8,1)+1,,,"Twenty ","Thirty ","Forty ","Fifty ","Sixty ","Seventy ","Eighty ","Ninety ") &IF(--MID(TEXT(B5,"000000000.00"),8,1)<>1,CHOOSE(MID(TEXT(B5,"000000000.00"),9,1)+1,,"One","Two","Three","Four","Five","Six","Seven","Eight","Nine"),CHOOSE(MID(TEXT(B5,"000000000.00"),9,1)+1,"Ten","Eleven","Twelve","Thirteen","Fourteen","Fifteen","Sixteen","Seventeen","Eighteen","Nineteen"))

Formula to convert number to words

The entire formula may appear complicated at first glance, yet it is essentially a repetition of a single portion. So, if you can understand the first portion of the formula, you should be able to understand the rest.

  • Subsequently, press ENTER.

As a result, you will see the following output.

Formula Breakdown:

At first, the TEXT function is used here to turn the number into a “000000000.00” text format.

TEXT(B7,”000000000.00″)

After that, the LEFT function is used to extract the left-most character from the number. It allows us to identify if the return number is zero or any other value.

LEFT(TEXT(B7,”000000000.00″))

Next, the CHOOSE function is used to represent the extracted number with appropriate words.

CHOOSE(LEFT(TEXT(B7,”000000000.00″))+1,,”One”,”Two”,”Three”,”Four”,”Five”,”Six”,”Seven”,”Eight”,”Nine”)

Now, it checks if the value is zero or not. If it is zero then it displays nothing.

CHOOSE(LEFT(TEXT(B7,”000000000.00″))+1,,”One”,”Two”,”Three”,”Four”,”Five”,”Six”,”Seven”,”Eight”,”Nine”)

&IF(–LEFT(TEXT(B7,”000000000.00″))=0,,

It will display “Hundred” if the next two numbers are zero. Otherwise, it will display “Hundred and.”

CHOOSE(LEFT(TEXT(B7,”000000000.00″))+1,,”One”,”Two”,”Three”,”Four”,”Five”,”Six”,”Seven”,”Eight”,”Nine”)

&IF(–LEFT(TEXT(B7,”000000000.00″))=0,,IF(AND(–MID(TEXT(B7,”000000000.00″),2,1)=0,–MID(TEXT(B7,”000000000.00″),3,1)=0),” Hundred”,” Hundred and “))

This formula does not require VBA or arrays. It’s an excellent method for turning numbers into words. However, it has two flaws. One, it can’t perfectly represent decimal numbers after points. Two, the maximum number limit is 999, 999, 999. Actually, Mr. Pete M. came up with this formula.

Lastly, you will get all the converted numbers into words.

Result for how does excel convert number to words

Read More: How to Convert Peso Number to Words in Excel


2. Applying VLOOKUP Function to Convert Numbers to Words

You can apply the VLOOKUP function to convert numbers to words in Excel. Let’s do something different. Here, you have to insert all the numbers in words first then you may use this function to convert any number into words from them.

Steps:

  • Firstly, write down all the numbers in words manually in the C column.

Applying VLOOKUP Function to Convert Numbers to Words in Excel

  • Now, use the following formula in the C12 cell.
=VLOOKUP(B12,B4:C9,2,FALSE)
  • Then, press ENTER.

Formula Breakdown

In this formula, the VLOOKUP function will return a value from a given array.

  • Firstly, B12 is the lookup value that it looks for in the given table.
  • Secondly, B4:C9 is the table array in which it looks for the target value.
  • Thirdly, 2 is the number of columns in the table from which a value is to be returned.
  • Fourthly, False denotes an exact match.


3. Using a VBA to convert Number to words in Excel

The most interesting part is that you can build your own function to convert the numbers to words in Excel. Moreover, you can employ the VBA code to develop a defined function. The steps are given below.

Steps:

  • Firstly, you have to choose the Developer tab >> then select Visual Basic.

Using a VBA macro for Wording Numbers in Excel

  • Now, from the Insert tab >> you have to select Module.

  • At this time, you need to write down the following Code in the Module.
Function number_converting_into_words(ByVal MyNumber)
Dim x_string As String
Dim whole_num As Integer
Dim x_string_pnt
Dim x_string_Num
Dim x_pnt As String
Dim x_numb As String
Dim x_P() As Variant
Dim x_DP
Dim x_cnt As Integer
Dim x_output, x_T As String
Dim x_my_len As Integer
On Error Resume Next
x_P = Array("", "Thousand ", "Million ", "Billion ", "Trillion ", " ", " ", " ", " ")
x_numb = Trim(Str(MyNumber))
x_DP = InStr(x_numb, ".")
x_pnt = ""
x_string_Num = ""
If x_DP > 0 Then
x_pnt = " point "
x_string = Mid(x_numb, x_DP + 1)
x_string_pnt = Left(x_string, Len(x_numb) - x_DP)
For whole_num = 1 To Len(x_string_pnt)
x_string = Mid(x_string_pnt, whole_num, 1)
x_pnt = x_pnt & get_digit(x_string) & " "
Next whole_num
x_numb = Trim(Left(x_numb, x_DP - 1))
End If
x_cnt = 0
x_output = ""
x_T = ""
x_my_len = 0
x_my_len = Int(Len(Str(x_numb)) / 3)
If (Len(Str(x_numb)) Mod 3) = 0 Then x_my_len = x_my_len - 1
Do While x_numb <> ""
If x_my_len = x_cnt Then
x_T = get_hundred_digit(Right(x_numb, 3), False)
Else
If x_cnt = 0 Then
x_T = get_hundred_digit(Right(x_numb, 3), True)
Else
x_T = get_hundred_digit(Right(x_numb, 3), False)
End If
End If
If x_T <> "" Then
x_output = x_T & x_P(x_cnt) & x_output
End If
If Len(x_numb) > 3 Then
x_numb = Left(x_numb, Len(x_numb) - 3)
Else
x_numb = ""
End If
x_cnt = x_cnt + 1
Loop
x_output = x_output & x_pnt
number_converting_into_words = x_output
End Function
Function get_hundred_digit(xHDgt, y_b As Boolean)
Dim x_R_str As String
Dim x_string_Num As String
Dim x_string As String
Dim y_I As Integer
Dim y_bb As Boolean
x_string_Num = xHDgt
x_R_str = ""
On Error Resume Next
y_bb = True
If Val(x_string_Num) = 0 Then Exit Function
x_string_Num = Right("000" & x_string_Num, 3)
x_string = Mid(x_string_Num, 1, 1)
If x_string <> "0" Then
x_R_str = get_digit(Mid(x_string_Num, 1, 1)) & "Hundred "
Else
If y_b Then
x_R_str = "and "
y_bb = False
Else
x_R_str = " "
y_bb = False
End If
End If
If Mid(x_string_Num, 2, 2) <> "00" Then
x_R_str = x_R_str & get_ten_digit(Mid(x_string_Num, 2, 2), y_bb)
End If
get_hundred_digit = x_R_str
End Function
Function get_ten_digit(x_TDgt, y_b As Boolean)
Dim x_string As String
Dim y_I As Integer
Dim x_array_1() As Variant
Dim x_array_2() As Variant
Dim x_T As Boolean
x_array_1 = Array("Ten ", "Eleven ", "Twelve ", "Thirteen ", "Fourteen ", "Fifteen ", "Sixteen ", "Seventeen ", "Eighteen ", "Nineteen ")
x_array_2 = Array("", "", "Twenty ", "Thirty ", "Forty ", "Fifty ", "Sixty ", "Seventy ", "Eighty ", "Ninety ")
x_string = ""
x_T = True
On Error Resume Next
If Val(Left(x_TDgt, 1)) = 1 Then
y_I = Val(Right(x_TDgt, 1))
If y_b Then x_string = "and "
x_string = x_string & x_array_1(y_I)
Else
y_I = Val(Left(x_TDgt, 1))
If Val(Left(x_TDgt, 1)) > 1 Then
If y_b Then x_string = "and "
x_string = x_string & x_array_2(Val(Left(x_TDgt, 1)))
x_T = False
End If
If x_string = "" Then
If y_b Then
x_string = "and "
End If
End If
If Right(x_TDgt, 1) <> "0" Then
x_string = x_string & get_digit(Right(x_TDgt, 1))
End If
End If
get_ten_digit = x_string
End Function
Function get_digit(xDgt)
Dim x_string As String
Dim x_array_1() As Variant
x_array_1 = Array("Zero ", "One ", "Two ", "Three ", "Four ", "Five ", "Six ", "Seven ", "Eight ", "Nine ")
x_string = ""
On Error Resume Next
x_string = x_array_1(Val(xDgt))
get_digit = x_string
End Function

  • Now, you have to save the code.
  • Then, you need to go to the Excel worksheet.

At this time, you can use your defined function. For this, you should follow the given steps.

Steps:

  • Now, select the cell you want to show the converted output. (In our case, cell C5).
  • Then, enter the Equal sign (=) in the cell. It should enable you to type formulas.
  • After that, type in “=number_converting_into_words” or select the number_converting_into_words function from the drop-down menu.
  • Subsequently, select the cell with the number value that you want to convert into words (In our case, cell B5).
  •  Finally, hit the ENTER button.

As a result, it will convert your selected cell number into the corresponding words. Lastly, you can simply copy this formula to the rest of the cells as well.

Read More: How to Convert Number to Words in Excel in Rupees


4. Employing VBA for Wording Currencies in Excel

This method is similar to the last one. It also works by inserting a module using VBA (Visual Basic for Application) and using it as a function. Where it differs from the last method is that it converts the numbers into appropriate currency words. Furthermore, an example is given below.

375.65=Three Hundred Seventy Five Dollars and Sixty Five Cents
There are two codes. Code 1 can convert numbers between to 999. On the other hand, Code 2 converts numbers greater than 999.

Now, follow these steps to apply this method:

  • Firstly, follow method-3 to insert the module.
  • Secondly, write down the following code in Module 2.

Code 1:

Function Convert_Number_into_word_with_currency(ByVal whole_number)
Dim converted_into_dollar, converted_into_cent
my_ary = Array("", "", " Thousand ", " Million ", " Billion ", " Trillion ")
whole_number = Trim(Str(whole_number))
x_decimal = InStr(whole_number, ".")
If x_decimal > 0 Then
    converted_into_cent = get_ten(Left(Mid(whole_number, x_decimal + 1) & "00", 2))
    whole_number = Trim(Left(whole_number, x_decimal - 1))
End If
xIndex = 1
Do While whole_number <> ""
    xHundred = ""
    xValue = Right(whole_number, 3)
    If Val(xValue) <> 0 Then
        xValue = Right("000" & xValue, 3)
        If Mid(xValue, 1, 1) <> "0" Then
            xHundred = get_digit(Mid(xValue, 1, 1)) & " Hundred "
        End If
        If Mid(xValue, 2, 1) <> "0" Then
            xHundred = xHundred & get_ten(Mid(xValue, 2))
        Else
            xHundred = xHundred & get_digit(Mid(xValue, 3))
        End If
    End If
    If xHundred <> "" Then
        converted_into_dollar = xHundred & my_ary(xIndex) & Dollar
    End If
    If Len(whole_number) > 3 Then
        whole_number = Left(whole_number, Len(whole_number) - 3)
    Else
        whole_number = ""
    End If
    xIndex = xIndex + 1
Loop
Select Case converted_into_dollar
    Case ""
        converted_into_dollar = " Zero Dollar"
    Case "One"
        converted_into_dollar = " One Dollar"
    Case Else
        converted_into_dollar = converted_into_dollar & "Dollars"
End Select
Select Case converted_into_cent
    Case ""
        converted_into_cent = " and Zero Cent"
    Case "One"
        converted_into_cent = " and One Cent"
    Case Else
        converted_into_cent = " and " & converted_into_cent & "Cents"
End Select
Convert_Number_into_word_with_currency = converted_into_dollar & converted_into_cent
End Function
Function get_ten(pTens)
Dim my_output As String
my_output = ""
If Val(Left(pTens, 1)) = 1 Then
    Select Case Val(pTens)
        Case 10: my_output = "Ten"
        Case 11: my_output = "Eleven"
        Case 12: my_output = "Twelve"
        Case 13: my_output = "Thirteen"
        Case 14: my_output = "Fourteen"
        Case 15: my_output = "Fifteen"
        Case 16: my_output = "Sixteen"
        Case 17: my_output = "Seventeen"
        Case 18: my_output = "Eighteen"
        Case 19: my_output = "Nineteen"
        Case Else
    End Select
Else
Select Case Val(Left(pTens, 1))
    Case 2: my_output = "Twenty "
    Case 3: my_output = "Thirty "
    Case 4: my_output = "Forty "
    Case 5: my_output = "Fifty "
    Case 6: my_output = "Sixty "
    Case 7: my_output = "Seventy "
    Case 8: my_output = "Eighty "
    Case 9: my_output = "Ninety "
    Case Else
End Select
my_output = my_output & get_digit(Right(pTens, 1))
End If
get_ten = my_output
End Function
Function get_digit(pDigit)
Select Case Val(pDigit)
    Case 1: get_digit = "One"
    Case 2: get_digit = "Two"
    Case 3: get_digit = "Three"
    Case 4: get_digit = "Four"
    Case 5: get_digit = "Five"
    Case 6: get_digit = "Six"
    Case 7: get_digit = "Seven"
    Case 8: get_digit = "Eight"
    Case 9: get_digit = "Nine"
    Case Else: get_digit = ""
End Select
End Function

Employing VBA to Convert Numbers to Words Currencies in Excel

As a result, you can use your defined function named Convert_Number_into_word_with_currency. For this, you should follow the given steps.

Steps:

  • Now, you have to select a cell, where you want to keep the result. We have selected the C5 cell.
  • Then, you need to use the corresponding formula in the C5 cell.
=Convert_Number_into_word_with_currency(B5)
  • Subsequently, press ENTER.

  • Finally, use the Excel AutoFill Feature for the rest of cells C6:C9.

Lastly, you will get all the converted amount.


Code 2:

  • You can use the code given below to convert numbers more than 999. Copy the code and paste it into the Module window.
Function ConvertNumberToWords(ByVal MyNumber) As String
    Dim Units As String
    Dim SubUnits As String
    Dim DecimalPlace As Integer
    Dim Count As Integer
    Dim DecimalSeparator As String
    Dim UnitName As String
    Dim SubUnitName As String
    Dim SubUnitNameAlt As String
    ' Change these values according to your requirements
    DecimalSeparator = "."
    UnitName = "US Dollars"
    SubUnitName = "Cents"
    SubUnitNameAlt = "Dollars"

    ReDim Place(9) As String
    Place(2) = " Thousand "
    Place(3) = " Million "
    Place(4) = " Billion "
    Place(5) = " Trillion "
    ' Convert MyNumber to String
    MyNumber = Trim(CStr(MyNumber))

    ' If MyNumber is blank, return zero
    If MyNumber = "" Then
        ConvertNumberToWords = "Zero"
        Exit Function
    End If

    ' Find position of decimal place, 0 if none.
    DecimalPlace = InStr(MyNumber, DecimalSeparator)

    ' Convert SubUnits and set MyNumber to Units amount.
    If DecimalPlace > 0 Then
        SubUnits = GetTens(Left(Mid(MyNumber, DecimalPlace + 1) & "00", 2))
        MyNumber = Trim(Left(MyNumber, DecimalPlace - 1))
    End If

    Count = 1
    Do While MyNumber <> ""
        TempStr = GetHundreds(Right(MyNumber, 3))
        If TempStr <> "" Then
            If Units <> "" Then
                If Count = 1 And Len(MyNumber) > 3 Then
                    Units = TempStr & " and" & Units
                Else
                    Units = TempStr & Place(Count) & Units
                End If
            Else
                Units = TempStr & Place(Count)
            End If
        End If
        If Len(MyNumber) > 3 Then
            MyNumber = Left(MyNumber, Len(MyNumber) - 3)
        Else
            MyNumber = ""
        End If
        Count = Count + 1
    Loop

    Dim Result As String
    Result = Trim(Units & " " & IIf(Count > 2, SubUnitNameAlt, IIf(Count = 2, SubUnitName, UnitName)))

    If SubUnits <> "" Then
        Result = Result & IIf(Count > 1, " and", "") & " " & SubUnits & " " & SubUnitName
    End If

    ConvertNumberToWords = Result
End Function

Function GetHundreds(ByVal MyNumber) As String
    Dim Result As String
    If Val(MyNumber) = 0 Then Exit Function
    MyNumber = Right("000" & MyNumber, 3)

    ' Convert the hundreds place.
    If Mid(MyNumber, 1, 1) <> "0" Then
        Result = GetDigit(Mid(MyNumber, 1, 1)) & " Hundred"
    End If

    ' Convert the tens and ones place.
    If Mid(MyNumber, 2, 1) <> "0" Then
        Result = Result & " " & GetTens(Mid(MyNumber, 2))
    Else
        Result = Result & " " & GetDigit(Mid(MyNumber, 3))
    End If
    GetHundreds = Result
End Function

Function GetTens(TensText) As String
    Dim Result As String
    Result = ""           ' Null out the temporary function value.
    If Val(Left(TensText, 1)) = 1 Then   ' If value between 10-19
        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                                 ' If value between 20-99
        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))   ' Retrieve ones place.
    End If
    GetTens = Result
End Function

Function GetDigit(Digit) As String
    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
  • Press Ctrl+S to save the code.
  • Then, use the function for wording currencies.

Convert numbers more than thousand to words in Excel

Read More: How to Use Spell Number in Excel


How to Convert Number to Text Format in Excel

So far, we’ve talked about how to convert numbers to words in Excel. This section of the article explains how to change numbers to text format in Excel. It is the simplest and fastest method to convert numbers into text.

Here, follow these steps to apply this method:

  • Firstly, select the cell or cells with numeric values that you want to convert into text (in our case, cell C5:C9)
  • Secondly, go to the Home tab and select the Text option from the cell category drop-down menu under the Number section.

Applying Format Cell Feature to convert numbers into text in Excel

As a result, it will convert your selected cells’ numeric value into text. You can understand it by observing the alignments. By default, texts are left-aligned and numbers are right-aligned in Excel.

Or you can press CTRL+1 to open the window named Format Cells and select the Number option and then select the Text category from there.


Practice Section

For doing practice, we have added a Practice portion on each sheet on the right portion.

Practice Section to convert number to words in Excel


Download Workbook


Conclusion

Here, we have tried to make this article an ultimate guide about how to convert number to appropriate words or text in MS Excel. Moreover, we have narrowed down seven different techniques in this article so that you can choose the ideal option that is best suited for your specific situation. So, we hope you find the solution you were looking for. Please leave a comment if you have any suggestions or questions. Thank you.


Related Articles


<< Go Back to Spell Number in Excel | Convert Number to Text | Learn Excel

Get FREE Advanced Excel Exercises with Solutions!
Chinmoy Mondol
Chinmoy Mondol

Chinmoy Mondol is a computer engineer who loves exploring Excel and VBA programming. Programming, to him, is a time-saving tool for efficiently managing data, files, and internet tasks. He is proficient in C, C++, Python, JavaScript, HTML, SQL, MySQL, PostgreSQL, Microsoft Office, and VBA and goes beyond the basics. He holds a B.Sc. in Computer Science and Engineering from American International University-Bangladesh. He has transitioned into the role of a content developer. Beyond his work, find him immersed... Read Full Bio

32 Comments
  1. x_array_1 = Array(“Ten “, “Eleven “, “Twelve “, “Thirteen “, “Fourteen “, “Fifteen “, “Sixteen “, “Seventeen “, “Eighteen “, “Nineteen “)

    Hi!!
    I have entered the whole code but when I try to apply i got an error message in the above line. It highlight the “, ” between “Thirteen “, “Fourteen “,
    Please kindly assist

    • Reply Avatar photo
      Naimul Hasan Arif Dec 11, 2022 at 12:34 PM

      Hello VULSTA KUZENA,
      Thanks for your comment. In my case, the code runs just perfect. I have not got any error message. There might have some extra characters in that place. You can try it or send me the file to [email protected] to let me have a try.

  2. 100000= one hundred thousand

    but i need to convert “one lac”.
    how can i do that.

    • Hello Arif,
      Thank you for sharing your query with us. As per your question, there can be 2 solutions to the problem.
      1. If your number is 100000, then convert it to One Lac with this formula where Thousand is kept blank.
      =CHOOSE(LEFT(TEXT(H6,"000000000.00"))+1,,"One","Two","Three","Four","Five","Six","Seven","Eight","Nine") &IF(--LEFT(TEXT(H6,"000000000.00"))=0,,IF(AND(--MID(TEXT(H6,"000000000.00"),2,1)=0,--MID(TEXT(H6,"000000000.00"),3,1)=0)," Lac"," Lac and ")) &CHOOSE(MID(TEXT(H6,"000000000.00"),2,1)+1,,,"Twenty ","Thirty ","Forty ","Fifty ","Sixty ","Seventy ","Eighty ","Ninety ") &IF(--MID(TEXT(H6,"000000000.00"),2,1)<>1,CHOOSE(MID(TEXT(H6,"000000000.00"),3,1)+1,,"One","Two","Three","Four","Five","Six","Seven","Eight","Nine"), CHOOSE(MID(TEXT(H6,"000000000.00"),3,1)+1,"Ten","Eleven","Twelve","Thirteen","Fourteen","Fifteen","Sixteen","Seventeen","Eighteen","Nineteen")) &IF((--LEFT(TEXT(H6,"000000000.00"))+MID(TEXT(H6,"000000000.00"),2,1)+MID(TEXT(H6,"000000000.00"),3,1))=0,,IF(AND((--MID(TEXT(H6,"000000000.00"),4,1)+MID(TEXT(H6,"000000000.00"),5,1)+MID(TEXT(H6,"000000000.00"),6,1)+MID(TEXT(H6,"000000000.00"),7,1))=0,(--MID(TEXT(H6,"000000000.00"),8,1)+RIGHT(TEXT(H6,"000000000.00")))>0)," Crore and "," Crore ")) &CHOOSE(MID(TEXT(H6,"000000000.00"),4,1)+1,,"One","Two","Three","Four","Five","Six","Seven","Eight","Nine") &IF(--MID(TEXT(H6,"000000000.00"),4,1)=0,,IF(AND(--MID(TEXT(H6,"000000000.00"),5,1)=0,--MID(TEXT(H6,"000000000.00"),6,1)=0)," Lac"," Lac")) &CHOOSE(MID(TEXT(H6,"000000000.00"),5,1)+1,,," Twenty"," Thirty"," Forty"," Fifty"," Sixty"," Seventy"," Eighty"," Ninety") &IF(--MID(TEXT(H6,"000000000.00"),5,1)<>1,CHOOSE(MID(TEXT(H6,"000000000.00"),6,1)+1,," One"," Two"," Three"," Four"," Five"," Six"," Seven"," Eight"," Nine"),CHOOSE(MID(TEXT(H6,"000000000.00"),6,1)+1," Ten"," Eleven"," Twelve"," Thirteen"," Fourteen"," Fifteen"," Sixteen"," Seventeen"," Eighteen"," Nineteen")) &IF((--MID(TEXT(H6,"000000000.00"),4,1)+MID(TEXT(H6,"000000000.00"),5,1)+MID(TEXT(H6,"000000000.00"),6,1))=0,,IF(OR((--MID(TEXT(H6,"000000000.00"),7,1)+MID(TEXT(H6,"000000000.00"),8,1)+MID(TEXT(H6,"000000000.00"),9,1))=0,--MID(TEXT(H6,"000000000.00"),7,1)<>0)," "," ")) &CHOOSE(MID(TEXT(H6,"000000000.00"),7,1)+1,,"One","Two","Three","Four","Five","Six","Seven","Eight","Nine") &IF(--MID(TEXT(H6,"000000000.00"),7,1)=0,,IF(AND(--MID(TEXT(H6,"000000000.00"),8,1)=0,--MID(TEXT(H6,"000000000.00"),9,1)=0)," Hundred "," Hundred and "))& CHOOSE(MID(TEXT(H6,"000000000.00"),8,1)+1,,,"Twenty ","Thirty ","Forty ","Fifty ","Sixty ","Seventy ","Eighty ","Ninety ") &IF(--MID(TEXT(H6,"000000000.00"),8,1)<>1,CHOOSE(MID(TEXT(H6,"000000000.00"),9,1)+1,,"One","Two","Three","Four","Five","Six","Seven","Eight","Nine"),CHOOSE(MID(TEXT(H6,"000000000.00"),9,1)+1,"Ten","Eleven","Twelve","Thirteen","Fourteen","Fifteen","Sixteen","Seventeen","Eighteen","Nineteen"))

      2. If your number is 123450, convert it into a word with this formula.
      =CHOOSE(LEFT(TEXT(H6,"000000000.00"))+1,,"One","Two","Three","Four","Five","Six","Seven","Eight","Nine") &IF(--LEFT(TEXT(H6,"000000000.00"))=0,,IF(AND(--MID(TEXT(H6,"000000000.00"),2,1)=0,--MID(TEXT(H6,"000000000.00"),3,1)=0)," Lac"," Lac and ")) &CHOOSE(MID(TEXT(H6,"000000000.00"),2,1)+1,,,"Twenty ","Thirty ","Forty ","Fifty ","Sixty ","Seventy ","Eighty ","Ninety ") &IF(--MID(TEXT(H6,"000000000.00"),2,1)<>1,CHOOSE(MID(TEXT(H6,"000000000.00"),3,1)+1,,"One","Two","Three","Four","Five","Six","Seven","Eight","Nine"), CHOOSE(MID(TEXT(H6,"000000000.00"),3,1)+1,"Ten","Eleven","Twelve","Thirteen","Fourteen","Fifteen","Sixteen","Seventeen","Eighteen","Nineteen")) &IF((--LEFT(TEXT(H6,"000000000.00"))+MID(TEXT(H6,"000000000.00"),2,1)+MID(TEXT(H6,"000000000.00"),3,1))=0,,IF(AND((--MID(TEXT(H6,"000000000.00"),4,1)+MID(TEXT(H6,"000000000.00"),5,1)+MID(TEXT(H6,"000000000.00"),6,1)+MID(TEXT(H6,"000000000.00"),7,1))=0,(--MID(TEXT(H6,"000000000.00"),8,1)+RIGHT(TEXT(H6,"000000000.00")))>0)," Crore and "," Crore ")) &CHOOSE(MID(TEXT(H6,"000000000.00"),4,1)+1,,"One","Two","Three","Four","Five","Six","Seven","Eight","Nine") &IF(--MID(TEXT(H6,"000000000.00"),4,1)=0,,IF(AND(--MID(TEXT(H6,"000000000.00"),5,1)=0,--MID(TEXT(H6,"000000000.00"),6,1)=0)," Lac"," Lac")) &CHOOSE(MID(TEXT(H6,"000000000.00"),5,1)+1,,," Twenty"," Thirty"," Forty"," Fifty"," Sixty"," Seventy"," Eighty"," Ninety") &IF(--MID(TEXT(H6,"000000000.00"),5,1)<>1,CHOOSE(MID(TEXT(H6,"000000000.00"),6,1)+1,," One"," Two"," Three"," Four"," Five"," Six"," Seven"," Eight"," Nine"),CHOOSE(MID(TEXT(H6,"000000000.00"),6,1)+1," Ten"," Eleven"," Twelve"," Thirteen"," Fourteen"," Fifteen"," Sixteen"," Seventeen"," Eighteen"," Nineteen")) &IF((--MID(TEXT(H6,"000000000.00"),4,1)+MID(TEXT(H6,"000000000.00"),5,1)+MID(TEXT(H6,"000000000.00"),6,1))=0,,IF(OR((--MID(TEXT(H6,"000000000.00"),7,1)+MID(TEXT(H6,"000000000.00"),8,1)+MID(TEXT(H6,"000000000.00"),9,1))=0,--MID(TEXT(H6,"000000000.00"),7,1)<>0)," "," ")) &CHOOSE(MID(TEXT(H6,"000000000.00"),7,1)+1,,"One","Two","Three","Four","Five","Six","Seven","Eight","Nine") &IF(--MID(TEXT(H6,"000000000.00"),7,1)=0,,IF(AND(--MID(TEXT(H6,"000000000.00"),8,1)=0,--MID(TEXT(H6,"000000000.00"),9,1)=0)," Hundred "," Hundred and "))& CHOOSE(MID(TEXT(H6,"000000000.00"),8,1)+1,,,"Twenty ","Thirty ","Forty ","Fifty ","Sixty ","Seventy ","Eighty ","Ninety ") &IF(--MID(TEXT(H6,"000000000.00"),8,1)<>1,CHOOSE(MID(TEXT(H6,"000000000.00"),9,1)+1,,"One","Two","Three","Four","Five","Six","Seven","Eight","Nine"),CHOOSE(MID(TEXT(H6,"000000000.00"),9,1)+1,"Ten","Eleven","Twelve","Thirteen","Fourteen","Fifteen","Sixteen","Seventeen","Eighteen","Nineteen"))

      I hope this solution will help you. Let us know your feedback.

      Regards,
      Guria
      ExcelDemy

  3. Hi, this is excellent. Just one query…

    I used Solution 3: Using a VBA to convert Number to words in Excel

    I’d like to output “nil” or “zero” when I enter the digit zero 0. At present, when I enter 0 in the cell, nothing gets outputted as text.

    For example; if A1=0, B1=number_converting_into_words(A1) outputs no text. No error, it’s just blank.

    Any ideas where I can change this in the code?

    • Dear Damien,
      Thank you for your comment. To get “zero” or “Nil” for the value 0, you have to simply add an IF statement with the code.
      you can use the following code:

       Function number_converting_into_words(MyNumber)
      
      Dim x_string As String
      Dim whole_num As Integer
      Dim x_string_pnt
      Dim x_string_Num
      Dim x_pnt As String
      Dim x_numb As String
      Dim x_P() As Variant
      Dim x_DP
      Dim x_cnt As Integer
      Dim x_output, x_T As String
      Dim x_my_len As Integer
      
      On Error Resume Next
      
      x_P = Array("", "Thousand ", "Million ", "Billion ", "Trillion ", " ", " ", " ", " ")
      x_numb = Trim(Str(MyNumber))
      x_DP = InStr(x_numb, ".")
      x_pnt = ""
      x_string_Num = ""
      
      If MyNumber = 0 Then
          number_converting_into_words = "zero"
          
      Else
      
          If x_DP > 0 Then
              x_pnt = " point "
              x_string = Mid(x_numb, x_DP + 1)
              x_string_pnt = Left(x_string, Len(x_numb) - x_DP)
          
              For whole_num = 1 To Len(x_string_pnt)
                  x_string = Mid(x_string_pnt, whole_num, 1)
                  x_pnt = x_pnt & get_digit(x_string) & " "
              Next whole_num
              
              x_numb = Trim(Left(x_numb, x_DP - 1))
          End If
          
          x_cnt = 0
          x_output = ""
          x_T = ""
          x_my_len = 0
          x_my_len = Int(Len(Str(x_numb)) / 3)
          
          If (Len(Str(x_numb)) Mod 3) = 0 Then x_my_len = x_my_len - 1
          
              Do While x_numb  ""
                  If x_my_len = x_cnt Then
                      x_T = get_hundred_digit(Right(x_numb, 3), False)
                  Else
                      If x_cnt = 0 Then
                          x_T = get_hundred_digit(Right(x_numb, 3), True)
                      Else
                          x_T = get_hundred_digit(Right(x_numb, 3), False)
                      End If
                  End If
                  If x_T  "" Then
                      x_output = x_T & x_P(x_cnt) & x_output
                  End If
                  If Len(x_numb) > 3 Then
                      x_numb = Left(x_numb, Len(x_numb) - 3)
                  Else
                      x_numb = ""
                  End If
                  x_cnt = x_cnt + 1
              Loop
              x_output = x_output & x_pnt
              number_converting_into_words = x_output
          End If
      
      End Function
      Function get_hundred_digit(xHDgt, y_b As Boolean)
      Dim x_R_str As String
      Dim x_string_Num As String
      Dim x_string As String
      Dim y_I As Integer
      Dim y_bb As Boolean
      x_string_Num = xHDgt
      x_R_str = ""
      On Error Resume Next
      y_bb = True
      If Val(x_string_Num) = 0 Then Exit Function
      x_string_Num = Right("000" & x_string_Num, 3)
      x_string = Mid(x_string_Num, 1, 1)
      If x_string  "0" Then
      x_R_str = get_digit(Mid(x_string_Num, 1, 1)) & "Hundred "
      Else
      If y_b Then
      x_R_str = "and "
      y_bb = False
      Else
      x_R_str = " "
      y_bb = False
      End If
      End If
      If Mid(x_string_Num, 2, 2)  "00" Then
      x_R_str = x_R_str & get_ten_digit(Mid(x_string_Num, 2, 2), y_bb)
      End If
      get_hundred_digit = x_R_str
      End Function
      Function get_ten_digit(x_TDgt, y_b As Boolean)
      Dim x_string As String
      Dim y_I As Integer
      Dim x_array_1() As Variant
      Dim x_array_2() As Variant
      Dim x_T As Boolean
      x_array_1 = Array("Ten ", "Eleven ", "Twelve ", "Thirteen ", "Fourteen ", "Fifteen ", "Sixteen ", "Seventeen ", "Eighteen ", "Nineteen ")
      x_array_2 = Array("", "", "Twenty ", "Thirty ", "Forty ", "Fifty ", "Sixty ", "Seventy ", "Eighty ", "Ninety ")
      x_string = ""
      x_T = True
      On Error Resume Next
      If Val(Left(x_TDgt, 1)) = 1 Then
      y_I = Val(Right(x_TDgt, 1))
      If y_b Then x_string = "and "
      x_string = x_string & x_array_1(y_I)
      Else
      y_I = Val(Left(x_TDgt, 1))
      If Val(Left(x_TDgt, 1)) > 1 Then
      If y_b Then x_string = "and "
      x_string = x_string & x_array_2(Val(Left(x_TDgt, 1)))
      x_T = False
      End If
      If x_string = "" Then
      If y_b Then
      x_string = "and "
      End If
      End If
      If Right(x_TDgt, 1)  "0" Then
      x_string = x_string & get_digit(Right(x_TDgt, 1))
      End If
      End If
      get_ten_digit = x_string
      End Function
      Function get_digit(xDgt)
      Dim x_string As String
      Dim x_array_1() As Variant
      x_array_1 = Array("Zero ", "One ", "Two ", "Three ", "Four ", "Five ", "Six ", "Seven ", "Eight ", "Nine ")
      x_string = ""
      On Error Resume Next
      x_string = x_array_1(Val(xDgt))
      get_digit = x_string
      End Function 

      Best,
      Afia Aziz Kona

  4. Tank you for that best work… really thats help me thanks

  5. Reply
    Md. Kamal Hossain Apr 25, 2023 at 3:12 PM

    Dear mem,
    Both are same formula when I apply those formula it given me “Twenty One Six Hundred and Twenty Nine” against number of 21,629.

    I need this format “Twenty One Thousand Six Hundred and Twenty Nine Taka Only”

    Plz check it & help me.

    • Dear MD. KAMAL HOSSAIN,

      To obtain your required format please follow the following simple steps:
      From your Excel Workbook, press ALT + F11 to open Visual Basic Editor.
      Insert a module.
      Paste the following code:

      Function NumberToWords(ByVal Number As Long) As String
          Dim Ones() As String
          Dim Tens() As String
          Dim Group() As String
          Dim Result As String
          
          Ones = Split("One,Two,Three,Four,Five,Six,Seven,Eight,Nine", ",")
          Tens = Split("Ten,Eleven,Twelve,Thirteen,Fourteen,Fifteen,Sixteen,Seventeen,Eighteen,Nineteen", ",")
          Group = Split("Twenty,Thirty,Forty,Fifty,Sixty,Seventy,Eighty,Ninety", ",")
          
          If Number = 0 Then ' Handle zero
              Result = ""
          ElseIf Number < 10 Then
              Result = Ones(Number - 1)
          ElseIf Number < 20 Then
              Result = Tens(Number - 10)
          ElseIf Number < 100 Then
              If Number Mod 10 = 0 Then ' Handle multiples of 10
                  Result = Group(Int(Number / 10) - 2)
              Else
                  Result = Group(Int(Number / 10) - 2) & " " & Ones(Number Mod 10 - 1)
              End If
          ElseIf Number < 1000 Then
              Result = Ones(Int(Number / 100) - 1) & " Hundred " & NumberToWords(Number Mod 100)
          ElseIf Number < 1000000 Then
              Result = NumberToWords(Int(Number / 1000)) & " Thousand " & NumberToWords(Number Mod 1000)
          ElseIf Number < 1000000000 Then
              Result = NumberToWords(Int(Number / 1000000)) & " Million " & NumberToWords(Number Mod 1000000)
          Else
              Result = "Number is too large."
          End If
          
          NumberToWords = Trim(Result)
      End Function

      Now, return to your worksheet. Type in the following formula in the cell where you require the output and press Enter key.
      =NumberToWords(B5) & ” Taka Only”
      Here, B5 indicates the reference of the cell where you have the input number.

      converting numbers to words

      I hope this solution will be sufficient for your requirements. Let us know your feedback.

      Regards,
      ExcelDemy

  6. I want to implement convert formula in all excel sheets. Requested to please furnish me the way.

    • Reply Avatar photo
      Naimul Hasan Arif May 2, 2023 at 3:05 PM

      Dear MUHAMMAD,
      In order to apply the number to words conversion in all worksheets of a particular workbook., you can create a function and place it in a module. As you have created a function in a module, it will be available in all worksheets of that particular workbook.

      Like I have created a module and a function named number_converting_into_words with the following VBA code.

      Function number_converting_into_words(ByVal MyNumber)
      Dim x_string As String
      Dim whole_num As Integer
      Dim x_string_pnt
      Dim x_string_Num
      Dim x_pnt As String
      Dim x_numb As String
      Dim x_P() As Variant
      Dim x_DP
      Dim x_cnt As Integer
      Dim x_output, x_T As String
      Dim x_my_len As Integer
      On Error Resume Next
      x_P = Array("", "Thousand ", "Million ", "Billion ", "Trillion ", " ", " ", " ", " ")
      x_numb = Trim(Str(MyNumber))
      x_DP = InStr(x_numb, ".")
      x_pnt = ""
      x_string_Num = ""
      If x_DP > 0 Then
      x_pnt = " point "
      x_string = Mid(x_numb, x_DP + 1)
      x_string_pnt = Left(x_string, Len(x_numb) - x_DP)
      For whole_num = 1 To Len(x_string_pnt)
      x_string = Mid(x_string_pnt, whole_num, 1)
      x_pnt = x_pnt & get_digit(x_string) & " "
      Next whole_num
      x_numb = Trim(Left(x_numb, x_DP - 1))
      End If
      x_cnt = 0
      x_output = ""
      x_T = ""
      x_my_len = 0
      x_my_len = Int(Len(Str(x_numb)) / 3)
      If (Len(Str(x_numb)) Mod 3) = 0 Then x_my_len = x_my_len - 1
      Do While x_numb <> ""
      If x_my_len = x_cnt Then
      x_T = get_hundred_digit(Right(x_numb, 3), False)
      Else
      If x_cnt = 0 Then
      x_T = get_hundred_digit(Right(x_numb, 3), True)
      Else
      x_T = get_hundred_digit(Right(x_numb, 3), False)
      End If
      End If
      If x_T <> "" Then
      x_output = x_T & x_P(x_cnt) & x_output
      End If
      If Len(x_numb) > 3 Then
      x_numb = Left(x_numb, Len(x_numb) - 3)
      Else
      x_numb = ""
      End If
      x_cnt = x_cnt + 1
      Loop
      x_output = x_output & x_pnt
      number_converting_into_words = x_output
      End Function

      Now, you can call the function in all worksheets of that particular workbook in the following way and have your number converted into words.

      I hope you have found your desired answer.

      Your regards,
      Naimul Hasan Arif

  7. Thanks a lot for this.
    When I used the module 2 code, the converted word didn’t come out complete. 99,756.86 came out as ninety nine thousand naira eight six kobo
    I had changed dollar to my currency in module 2 code. Could that be the problem?

    • Reply Mahfuza Anika Era
      Mahfuza Anika Era May 11, 2023 at 4:51 PM

      Dear Max,
      Thank you for your query. Changing the currency is not the reason behind the incorrect output of the module 2 code. Actually, the code is not working for the last 3 digits of the whole number part. Here is the modified code of module 1 that may help you. This will give the correct result hopefully.

      Function number_converting_into_currency(ByVal MyNumber)
      Dim x_string As String
      Dim whole_num As Integer
      Dim x_string_pnt
      Dim x_string_Num
      Dim x_pnt As String
      Dim x_numb As String
      Dim x_P() As Variant
      Dim x_DP
      Dim x_cnt As Integer
      Dim x_output, x_T As String
      Dim x_my_len As Integer
      On Error Resume Next
      x_P = Array("", "Thousand ", "Million ", "Billion ", "Trillion ", " ", " ", " ", " ")
      x_numb = Trim(Str(MyNumber))
      x_DP = InStr(x_numb, ".")
      x_pnt = ""
      x_string_Num = ""
      If x_DP > 0 Then
      x_pnt = " "
      x_string = Mid(x_numb, x_DP + 1)
      x_string_pnt = Left(x_string, Len(x_numb) - x_DP)
      For whole_num = 1 To Len(x_string_pnt)
      x_string = Mid(x_string_pnt, whole_num, 1)
      x_pnt = x_pnt & get_digit(x_string) & " "
      Next whole_num
      x_numb = Trim(Left(x_numb, x_DP - 1))
      End If
      x_cnt = 0
      x_output = ""
      x_T = ""
      x_my_len = 0
      x_my_len = Int(Len(Str(x_numb)) / 3)
      If (Len(Str(x_numb)) Mod 3) = 0 Then x_my_len = x_my_len - 1
      Do While x_numb <> ""
      If x_my_len = x_cnt Then
      x_T = get_hundred_digit(Right(x_numb, 3), False)
      Else
      If x_cnt = 0 Then
      x_T = get_hundred_digit(Right(x_numb, 3), True)
      Else
      x_T = get_hundred_digit(Right(x_numb, 3), False)
      End If
      End If
      If x_T <> "" Then
      x_output = x_T & x_P(x_cnt) & x_output
      End If
      If Len(x_numb) > 3 Then
      x_numb = Left(x_numb, Len(x_numb) - 3)
      Else
      x_numb = ""
      End If
      x_cnt = x_cnt + 1
      Loop
      If x_DP > 0 Then
      x_output = x_output & "dollars" & x_pnt & "Cents"
      Else
      x_output = x_output & "dollars"
      End If
      number_converting_into_currency = x_output
      End Function
      Function get_hundred_digit(xHDgt, y_b As Boolean)
      Dim x_R_str As String
      Dim x_string_Num As String
      Dim x_string As String
      Dim y_I As Integer
      Dim y_bb As Boolean
      x_string_Num = xHDgt
      x_R_str = ""
      On Error Resume Next
      y_bb = True
      If Val(x_string_Num) = 0 Then Exit Function
      x_string_Num = Right("000" & x_string_Num, 3)
      x_string = Mid(x_string_Num, 1, 1)
      If x_string <> "0" Then
      x_R_str = get_digit(Mid(x_string_Num, 1, 1)) & "Hundred "
      Else
      If y_b Then
      x_R_str = "and "
      y_bb = False
      Else
      x_R_str = " "
      y_bb = False
      End If
      End If
      If Mid(x_string_Num, 2, 2) <> "00" Then
      x_R_str = x_R_str & get_ten_digit(Mid(x_string_Num, 2, 2), y_bb)
      End If
      get_hundred_digit = x_R_str
      End Function
      Function get_ten_digit(x_TDgt, y_b As Boolean)
      Dim x_string As String
      Dim y_I As Integer
      Dim x_array_1() As Variant
      Dim x_array_2() As Variant
      Dim x_T As Boolean
      x_array_1 = Array("Ten ", "Eleven ", "Twelve ", "Thirteen ", "Fourteen ", "Fifteen ", "Sixteen ", "Seventeen ", "Eighteen ", "Nineteen ")
      x_array_2 = Array("", "", "Twenty ", "Thirty ", "Forty ", "Fifty ", "Sixty ", "Seventy ", "Eighty ", "Ninety ")
      x_string = ""
      x_T = True
      On Error Resume Next
      If Val(Left(x_TDgt, 1)) = 1 Then
      y_I = Val(Right(x_TDgt, 1))
      If y_b Then x_string = "and "
      x_string = x_string & x_array_1(y_I)
      Else
      y_I = Val(Left(x_TDgt, 1))
      If Val(Left(x_TDgt, 1)) > 1 Then
      If y_b Then x_string = "and "
      x_string = x_string & x_array_2(Val(Left(x_TDgt, 1)))
      x_T = False
      End If
      If x_string = "" Then
      If y_b Then
      x_string = " "
      End If
      End If
      If Right(x_TDgt, 1) <> "0" Then
      x_string = x_string & get_digit(Right(x_TDgt, 1))
      End If
      End If
      get_ten_digit = x_string
      End Function
      Function get_digit(xDgt)
      Dim x_string As String
      Dim x_array_1() As Variant
      x_array_1 = Array("Zero ", "One ", "Two ", "Three ", "Four ", "Five ", "Six ", "Seven ", "Eight ", "Nine ")
      x_string = ""
      On Error Resume Next
      x_string = x_array_1(Val(xDgt))
      get_digit = x_string
      End Function

      Copy the code in your module and Run the code.

      I hope you have got your problem solved. Thank you.
      Regards
      Mahfuza Anika Era
      ExcelDemy

  8. If I would apply 123,456.12 into wordings “One Hundred And Twenty Three Thousand Four Hundred And Fifty Six And Cents Twelve Only”

    I would like the wording “One Hundred And Twenty Three Thousand Four Hundred And Fifty Six And Cents Twelve Only” instead of “Hong Kong Dollars One Hundred and Twenty Three Thousand Four Hundred and Fifty Six point One Two Only”

    May i have the VBA code to apply? A million thanks.

    • Reply Mahfuza Anika Era
      Mahfuza Anika Era Aug 28, 2023 at 5:29 PM

      Dear Salad,
      Thanks for your question. Here is the VBA code that will give you your mentioned output.

      Function NumberToWords(ByVal MyNumber)
          Dim TempStr As String
          Dim DecimalPlace As Integer
          Dim Count As Integer
          Dim DecimalSeparator As String
          Dim UnitName As String
          Dim SubUnitName As String
          Dim SubUnitValue As String
          Dim DecimalName As String
          Dim WholeNumberPart As String
          Dim DecimalPart As String
      
          DecimalSeparator = "point"
          UnitName = "Dollars"
          SubUnitName = "Cents"
          SubUnitValue = " "
          DecimalName = "Zero"
      
          MyNumber = Trim(Str(MyNumber))
      
          DecimalPlace = InStr(MyNumber, ".")
      
          If DecimalPlace > 0 Then
              DecimalPart = GetTens(Left(Mid(MyNumber, DecimalPlace + 1) & "00", 2))
              MyNumber = Trim(Left(MyNumber, DecimalPlace - 1))
          End If
      
          Count = 1
          Do While MyNumber <> ""
              TempStr = GetHundreds(Right(MyNumber, 3))
              If TempStr <> "" Then
                  WholeNumberPart = TempStr & GetUnits(Count) & WholeNumberPart
              End If
              If Len(MyNumber) > 3 Then
                  MyNumber = Left(MyNumber, Len(MyNumber) - 3)
              Else
                  MyNumber = ""
              End If
              Count = Count + 1
          Loop
      
          NumberToWords = WholeNumberPart & IIf(DecimalPart <> "", " and " & DecimalSeparator & " " & DecimalPart & " " & SubUnitName & " " & SubUnitValue, "")
      End Function
      
      Function GetUnits(ByVal Count)
          Select Case Count
              Case 1
                  GetUnits = ""
              Case 2
                  GetUnits = " Thousand"
              Case 3
                  GetUnits = " Million"
              Case 4
                  GetUnits = " Billion"
              Case 5
                  GetUnits = " Trillion"
              Case Else
                  GetUnits = ""
          End Select
      End Function
      
      Function GetHundreds(ByVal MyNumber)
          Dim Result As String
          If Val(MyNumber) = 0 Then Exit Function
          MyNumber = Right("000" & MyNumber, 3)
          If Mid(MyNumber, 1, 1) <> "0" Then
              Result = GetDigit(Mid(MyNumber, 1, 1)) & " Hundred "
          End If
          If Mid(MyNumber, 2, 1) <> "0" Then
              Result = Result & GetTens(Mid(MyNumber, 2))
          Else
              Result = Result & GetDigit(Mid(MyNumber, 3))
          End If
          GetHundreds = Result
      End Function
      
      Function GetTens(TensText)
          Dim Result As String
          Result = ""           ' Null out the temporary function value.
          If Val(Left(TensText, 1)) = 1 Then   ' If value between 10-19...
              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                                 ' If value between 20-99...
              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))   ' Retrieve ones place.
          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
      End If

      Following is the output after using the code.

      convert to currency using VBA

      Regards
      Mahfuza Anika Era
      ExcelDemy

  9. pls can you send me simple formula to change number to word

    • Dear Amir

      You have to use either the combined formula or the vba code. Because converting number to words maintaing the place vaule is not possible by simple formula.

      Regards
      ExcelDemy

  10. Reply
    Felix Amankwah Boateng Sep 15, 2023 at 6:04 PM

    The problem I’m facing is seen below:

    934,738.22 – “Nine Hundred Thirty Four Thousand Cedis and Twenty Two Pesewas”
    instead of “Nine Hundred and Thirty Four Thousand Seven Hundred and Thirty Eight Cedis and Twenty Two Pesewas”
    3,308,611.99 – “Three Million Three Hundred Cedis and Ninety Nine Pesewas”
    instead of “Three Million Three Hundred and Eight Thousand Six Hundred and Eleven Cedis and Ninety Nine Pesewas”

    • Reply Mursalin
      Mursalin Ibne Salehin Sep 19, 2023 at 11:18 AM

      Hi FELIX,

      Thanks for your comment. To get your desired output, you need to use the VBA code given below. We have created a custom function to convert numbers to currency words.

      1. Copy the VBA code and paste it into the Module window.

      Function ConvertNumberToWords(ByVal MyNumber) As String
          Dim Units As String
          Dim SubUnits As String
          Dim DecimalPlace As Integer
          Dim Count As Integer
          Dim DecimalSeparator As String
          Dim UnitName As String
          Dim SubUnitName As String
          Dim SubUnitNameAlt As String
      
          ' Change these values according to your requirements
          DecimalSeparator = "."
          UnitName = "Cedis"
          SubUnitName = "Pesewas"
          SubUnitNameAlt = "Cedis"
      
          ReDim Place(9) As String
          Place(2) = " Thousand "
          Place(3) = " Million "
          Place(4) = " Billion "
          Place(5) = " Trillion "
      
          ' Convert MyNumber to String
          MyNumber = Trim(CStr(MyNumber))
      
          ' If MyNumber is blank, return zero
          If MyNumber = "" Then
              ConvertNumberToWords = "Zero"
              Exit Function
          End If
      
          ' Find position of decimal place, 0 if none.
          DecimalPlace = InStr(MyNumber, DecimalSeparator)
      
          ' Convert SubUnits and set MyNumber to Units amount.
          If DecimalPlace > 0 Then
              SubUnits = GetTens(Left(Mid(MyNumber, DecimalPlace + 1) & "00", 2))
              MyNumber = Trim(Left(MyNumber, DecimalPlace - 1))
          End If
      
          Count = 1
          Do While MyNumber <> ""
              TempStr = GetHundreds(Right(MyNumber, 3))
              If TempStr <> "" Then
                  If Units <> "" Then
                      If Count = 1 And Len(MyNumber) > 3 Then
                          Units = TempStr & " and" & Units
                      Else
                          Units = TempStr & Place(Count) & Units
                      End If
                  Else
                      Units = TempStr & Place(Count)
                  End If
              End If
              If Len(MyNumber) > 3 Then
                  MyNumber = Left(MyNumber, Len(MyNumber) - 3)
              Else
                  MyNumber = ""
              End If
              Count = Count + 1
          Loop
      
          Dim Result As String
          Result = Trim(Units & " " & IIf(Count > 2, SubUnitNameAlt, IIf(Count = 2, SubUnitName, UnitName)))
      
          If SubUnits <> "" Then
              Result = Result & IIf(Count > 1, " and", "") & " " & SubUnits & " " & SubUnitName
          End If
      
          ConvertNumberToWords = Result
      End Function
      
      Function GetHundreds(ByVal MyNumber) As String
          Dim Result As String
          If Val(MyNumber) = 0 Then Exit Function
          MyNumber = Right("000" & MyNumber, 3)
      
          ' Convert the hundreds place.
          If Mid(MyNumber, 1, 1) <> "0" Then
              Result = GetDigit(Mid(MyNumber, 1, 1)) & " Hundred and"
          End If
      
          ' Convert the tens and ones place.
          If Mid(MyNumber, 2, 1) <> "0" Then
              Result = Result & " " & GetTens(Mid(MyNumber, 2))
          Else
              Result = Result & " " & GetDigit(Mid(MyNumber, 3))
          End If
          GetHundreds = Result
      End Function
      
      Function GetTens(TensText) As String
          Dim Result As String
          Result = ""           ' Null out the temporary function value.
          If Val(Left(TensText, 1)) = 1 Then   ' If value between 10-19
              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                                 ' If value between 20-99
              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))   ' Retrieve ones place.
          End If
          GetTens = Result
      End Function
      
      Function GetDigit(Digit) As String
          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

      2. Press Ctrl+S to save the code.
      3. Now, insert the formula in Cell C3 and press Enter.
      =ConvertNumberToWords(B3)

      I hope this code will give you the desired output. If you have any other queries, please let me know in the comment section.

      Regards
      Mursalin,
      ExcelDemy.

  11. The problem I’m facing is seen below:

    934,738.22 – “Ringgit Malaysia: Nine Hundred Thirty Four Thousand and Twenty Two Sen Only”

    3,308,611.99 – “Ringgit Malaysia: Three Million Three Hundred and Ninety Nine Sen Only”

    • Reply Mursalin
      Mursalin Ibne Salehin Sep 21, 2023 at 10:27 AM

      Hi HONG,

      Thanks for your comment. You can use the VBA code given below for the desired output.

      1. Copy the VBA code and paste it into the Module window.

      Function ConvertNumberToWords(ByVal MyNumber) As String
          Dim Units As String
          Dim SubUnits As String
          Dim DecimalPlace As Integer
          Dim Count As Integer
          Dim DecimalSeparator As String
          Dim UnitName As String
          Dim SubUnitName As String
          Dim SubUnitNameAlt As String
      
          ' Change these values according to your requirements
          DecimalSeparator = "."
          UnitName = "Ringgit Malaysia"
          SubUnitName = "Sen"
          SubUnitNameAlt = "Ringgit"
      
          ReDim Place(9) As String
          Place(2) = " Thousand "
          Place(3) = " Million "
          Place(4) = " Billion "
          Place(5) = " Trillion "
      
          ' Convert MyNumber to String
          MyNumber = Trim(CStr(MyNumber))
      
          ' If MyNumber is blank, return zero
          If MyNumber = "" Then
              ConvertNumberToWords = "Zero"
              Exit Function
          End If
      
          ' Find position of decimal place, 0 if none.
          DecimalPlace = InStr(MyNumber, DecimalSeparator)
      
          ' Convert SubUnits and set MyNumber to Units amount.
          If DecimalPlace > 0 Then
              SubUnits = GetTens(Left(Mid(MyNumber, DecimalPlace + 1) & "00", 2))
              MyNumber = Trim(Left(MyNumber, DecimalPlace - 1))
          End If
      
          Count = 1
          Do While MyNumber <> ""
              TempStr = GetHundreds(Right(MyNumber, 3))
              If TempStr <> "" Then
                  If Units <> "" Then
                      If Count = 1 And Len(MyNumber) > 3 Then
                          Units = TempStr & " and" & Units
                      Else
                          Units = TempStr & Place(Count) & Units
                      End If
                  Else
                      Units = TempStr & Place(Count)
                  End If
              End If
              If Len(MyNumber) > 3 Then
                  MyNumber = Left(MyNumber, Len(MyNumber) - 3)
              Else
                  MyNumber = ""
              End If
              Count = Count + 1
          Loop
      
          Dim Result As String
          Result = Trim(Units & " " & IIf(Count > 2, SubUnitNameAlt, IIf(Count = 2, SubUnitName, UnitName)))
      
          If SubUnits <> "" Then
              Result = Result & IIf(Count > 1, " and", "") & " " & SubUnits & " " & SubUnitName
          End If
      
          ConvertNumberToWords = Result
      End Function
      
      Function GetHundreds(ByVal MyNumber) As String
          Dim Result As String
          If Val(MyNumber) = 0 Then Exit Function
          MyNumber = Right("000" & MyNumber, 3)
      
          ' Convert the hundreds place.
          If Mid(MyNumber, 1, 1) <> "0" Then
              Result = GetDigit(Mid(MyNumber, 1, 1)) & " Hundred"
          End If
      
          ' Convert the tens and ones place.
          If Mid(MyNumber, 2, 1) <> "0" Then
              Result = Result & " " & GetTens(Mid(MyNumber, 2))
          Else
              Result = Result & " " & GetDigit(Mid(MyNumber, 3))
          End If
          GetHundreds = Result
      End Function
      
      Function GetTens(TensText) As String
          Dim Result As String
          Result = ""           ' Null out the temporary function value.
          If Val(Left(TensText, 1)) = 1 Then   ' If value between 10-19
              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                                 ' If value between 20-99
              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))   ' Retrieve ones place.
          End If
          GetTens = Result
      End Function
      
      Function GetDigit(Digit) As String
          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

      2. Press Ctrl+S to save the code.
      3. Now, insert the formula in Cell C3 and press Enter.
      =ConvertNumberToWords(B3)

      I hope this code will solve your problem. If you have any other queries, please let me know in the comment section.

      Regards
      Mursalin,
      ExcelDemy.

  12. How can I get –

    10245 as “One Zero Two Four Five” and so on

    • Reply Lutfor Rahman Shimanto
      Lutfor Rahman Shimanto Feb 7, 2024 at 1:38 PM

      Hello Samir

      Thanks for visiting our blog and posting an interesting comment. You want to convert a number (e.g., 10245) into a string where each digit of the number is represented by its word form (e.g., “One Zero Two Four Five”).

      I am delighted to inform you that I have developed an Excel VBA User-defined function named NumberToString to fulfil your goal. I am using the function in a Sub-procedure. However, you can also use it in Excel cells like other worksheet functions.

      OUTPUT OVERVIEW:

      Excel VBA Code:

      
      Function NumberToString(ByVal num As String) As String
          
          Dim result As String
          Dim i As Integer
          Dim digit As String
          
          Dim digits() As String
          digits = Split("Zero,One,Two,Three,Four,Five,Six,Seven,Eight,Nine", ",")
          
          For i = 1 To Len(num)
              digit = Mid(num, i, 1)
              result = result & digits(Val(digit)) & " "
          Next i
          
          NumberToString = Trim(result)
      
      End Function
      
      Sub TestNumberToWords()
          
          Dim num As Long
          num = 146897
          Debug.Print NumberToString(CStr(num))
      
      End Sub
      

      Hopefully, the user-defined function will help you reach your goal; good luck.

      Regards
      Lutfor Rahman Shimanto
      Excel & VBA Developer
      ExcelDemy

  13. Hi, Chinmoy Mondol, It’s an excellent article. Great job! However, when I copied the formula from method 1, it showed an error in Excel. I believe it has problems with line spacing or the quotation mark. Kindly check the formula.

    • Reply Lutfor Rahman Shimanto
      Lutfor Rahman Shimanto Feb 5, 2024 at 6:42 PM

      Hello EXCELFLASH

      Thanks a ton for taking the time to dive into our article and sharing your thoughts! We’re thrilled to hear that you found it excellent overall – that means a lot to us.

      We’re sorry you encountered an issue with the formula from method 1. After investigating, we discovered that you are correct about the line spacing and quotation marks issues in that formula when copying.

      We’ve updated the article, so feel free to retry it. Hopefully, this time around, you won’t encounter the same hassle with the formula. Let us know if you have any further questions or suggestions.

      Regards
      Lutfor Rahman Shimanto
      ExcelDemy

  14. Reply
    dinesh kumar suthar Feb 7, 2024 at 10:31 AM

    I want to convert whole numbers in word
    like the numbers 54362543 is showing “Fifty Four Million Three Hundred and Sixty Two Thousand Five Hundred and Forty Three” but i want to conver in “five crore fourty three lac sixty two thousand five hundred forty three”

    • Reply Lutfor Rahman Shimanto
      Lutfor Rahman Shimanto Feb 25, 2024 at 11:06 AM

      Hi DINESH,

      Thanks for your comment. You can use the VBA code given below for the desired output.

      1. Copy the following VBA code and paste it into the Module window:
        Public Function FormatCurrencyText(ByVal inputNumber As String) As String
            Dim decimalPosition As Integer
            Dim placeArray As Variant
            Dim paisaText As String
            Dim numText As String
            Dim index As Integer
            Dim tempText As String
            Dim strTemp As String
            Dim resultText As String
            Dim loopCounter As Integer
        
            ' Change these values according to your requirements
            placeArray = Array("", "", " Thousand ", " Lacs ", " Crores ", " Trillion ", "", "", "", "")
        
            On Error Resume Next
            If inputNumber = "" Then
                FormatCurrencyText = ""
                Exit Function
            End If
        
            numText = Trim(Str(inputNumber))
            If numText = "" Then
                FormatCurrencyText = ""
                Exit Function
            End If
        
            resultText = ""
            loopCounter = 0
        
            If (numText > 999999999.99) Then
                FormatCurrencyText = "Digit exceeds the maximum limit"
                Exit Function
            End If
        
            decimalPosition = InStr(numText, ".")
        
            If decimalPosition > 0 Then
                If (Len(numText) - decimalPosition) = 1 Then
                    paisaText = CurrencyText_GetT(Left(Mid(numText, decimalPosition + 1) & "0", 2))
                ElseIf (Len(numText) - decimalPosition) > 1 Then
                    paisaText = CurrencyText_GetT(Left(Mid(numText, decimalPosition + 1), 2))
                End If
        
                numText = Trim(Left(numText, decimalPosition - 1))
            End If
        
            index = 1
        
            Do While numText <> ""
                If (index >= 2) Then
                    tempText = Right(numText, 2)
                Else
                    If (Len(numText) = 2) Then
                        tempText = Right(numText, 2)
                    ElseIf (Len(numText) = 1) Then
                        tempText = Right(numText, 1)
                    Else
                        tempText = Right(numText, 3)
                    End If
                End If
        
                strTemp = ""
                If Val(tempText) > 99 Then
                    strTemp = CurrencyText_GetH(Right(tempText, 3), loopCounter)
                    If Right(Trim(strTemp), 3) <> "Lac" Then
                        loopCounter = loopCounter + 1
                    End If
                ElseIf Val(tempText) <= 99 And Val(tempText) > 9 Then
                    strTemp = CurrencyText_GetT(Right(tempText, 2))
                ElseIf Val(tempText) < 10 Then
                    strTemp = CurrencyText_GetD(Right(tempText, 2))
                End If
        
                If strTemp <> "" Then
                    resultText = strTemp & placeArray(index) & resultText
                End If
        
                If index = 2 Then
                    If Len(numText) = 1 Then
                        numText = ""
                    Else
                        numText = Left(numText, Len(numText) - 2)
                    End If
                ElseIf index = 3 Then
                    If Len(numText) >= 3 Then
                        numText = Left(numText, Len(numText) - 2)
                    Else
                        numText = ""
                    End If
                ElseIf index = 4 Then
                    numText = ""
                Else
                    If Len(numText) <= 2 Then
                        numText = ""
                    Else
                        numText = Left(numText, Len(numText) - 3)
                    End If
                End If
        
                index = index + 1
            Loop
        
            If resultText = "" Then
                resultText = "No Rupees"
            End If
        
            If paisaText <> "" Then
                paisaText = " and " & paisaText & " Paise"
            End If
        
            FormatCurrencyText = resultText & paisaText
        End Function
        
        Function CurrencyText_GetH(ByVal inputStrH As String, ByVal loopCounter As Integer) As String
            Dim resultText As String
        
            If Val(inputStrH) < 1 Then
                CurrencyText_GetH = ""
                Exit Function
            Else
                inputStrH = Right("000" & inputStrH, 3)
        
                If Mid(inputStrH, 1, 1) <> "0" Then
                    If (loopCounter > 0) Then
                        resultText = CurrencyText_GetD(Mid(inputStrH, 1, 1)) & " Lac "
                    Else
                        resultText = CurrencyText_GetD(Mid(inputStrH, 1, 1)) & " Hundred "
                    End If
                End If
        
                If Mid(inputStrH, 2, 1) <> "0" Then
                    resultText = resultText & CurrencyText_GetT(Mid(inputStrH, 2))
                Else
                    resultText = resultText & CurrencyText_GetD(Mid(inputStrH, 3))
                End If
            End If
        
            CurrencyText_GetH = resultText
        End Function
        
        Function CurrencyText_GetT(ByVal inputTStr As String) As String
            Dim arrT1 As Variant
            Dim arrT2 As Variant
            Dim resultText As String
        
            arrT1 = Array("Ten", "Eleven", "Twelve", "Thirteen", "Fourteen", "Fifteen", "Sixteen", "Seventeen", "Eighteen", "Nineteen")
            arrT2 = Array("", "Twenty", "Thirty", "Forty", "Fifty", "Sixty", "Seventy", "Eighty", "Ninety")
        
            resultText = ""
        
            If Val(Left(inputTStr, 1)) = 1 Then
                resultText = arrT1(Val(Mid(inputTStr, 2, 1)))
            Else
                If Val(Left(inputTStr, 1)) > 0 Then
                    resultText = arrT2(Val(Left(inputTStr, 1)) - 1)
                End If
        
                resultText = resultText & CurrencyText_GetD(Right(inputTStr, 1))
            End If
        
            CurrencyText_GetT = resultText
        End Function
        
        Function CurrencyText_GetD(ByVal inputDStr As String) As String
            Dim arr_1() As Variant
        
            arr_1 = Array(" One", " Two", " Three", " Four", " Five", " Six", " Seven", " Eight", " Nine", "")
        
            If Val(inputDStr) > 0 Then
                CurrencyText_GetD = arr_1(Val(inputDStr) - 1)
            Else
                CurrencyText_GetD = ""
            End If
        End Function
      2. Press Ctrl+S to save the code.
      3. Now, insert the formula in a cell and press Enter:
        =ConvertNumberToWords(Number)
        Or,
        =ConvertNumberToWords(Number containing cell reference)
        Like,
        =ConvertNumberToWords(54362543)
        Or,
        =ConvertNumberToWords(A1)

      I hope this user-defined function will solve your problem. Please let us know in the comment section if you have any other queries.

      Regards

      Maruf Hasan

      ExcelDemy

  15. Thanks for this excellent article.
    I suggest another code approach. It basically relies on a field feature in Word that allows this conversion.
    In word, the field is for example {= 1234 \*CardText}. This field will display the number (here 1234) into letters. Furthermore the output will be in the language selected in the document.
    Thus the excel vba code creates this field in a new word document and retreive the result.
    Here is the vba code (to be inserted in a new vba module) :

    Public Function NombreEnLettres(Number As Double, Optional Language As String = “EN”) As String
    Dim WDoc As Word.Document
    Dim WField As Field
    Dim WLanguage As WdLanguageID

    Set WDoc = CreateObject(“Word.Document”)

    Select Case Langue
    Case “EN”
    WDoc.Range.LanguageID = wdEnglishUK
    Case “FR”
    WDoc.Range.LanguageID = wdFrench
    Case Else
    WDoc.Range.LanguageID = wdEnglishUK
    End Select

    Set WField = WDoc.Fields.Add(Range:=WDoc.Range, Type:=wdFieldExpression, Text:=Number & ” \*CardText”)
    NombreEnLettres = WField.Result

    Set WDoc = Nothing

    End Function

    My user-defined function is named in French, but you may change it.
    The “Select Case” code is to prevent errors. Here it only handles EN and FR languages (with EN by default) but there is a whole bunch of other ones available.

    Regards,

    Gwenn

    • Hello Gwenn,

      Thanks for your suggestion. We deeply appreciate the solution provided in the comments. Thank you for your helpful contribution!

      Regards
      ExcelDemy

Leave a reply

Advanced Excel Exercises with Solutions PDF

 

 

ExcelDemy
Logo