By: Shamima Sultana

In reply to Atikah.

Dear Atikah,

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.

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

Regards,
ExcelDemy