Every country has its own significant currency that is used for regional banking, business, and educational purposes. Microsoft Excel has become a powerful tool in this sector. It benefits us to work with our own countries’ currency. But we also need to spell the numbered amounts to words. Excel also has a solution for this. In this article, we will learn how to spell the number in Excel in taka with easy steps.
How to Spell Number in Taka in Excel: with Easy Steps
Taka is the currency name in the regions where Bengali is their mother language. Therefore, it is sometimes necessary to convert spell numbers into taka in these locations. Excel functions have given us numerous options to do this. In this case, we will generate a new function with the help of Excel VBA Macro code and therefore spell the number in taka. So, without any delay, let’s follow the steps below.
Step 1: Create a New Dataset
To illustrate the process, here we have prepared a dataset. This dataset shows the information of 5 types of amounts in Taka in cell range B5:B9. Along with it, we reserved cell range C5:C9 for getting the output.
Step 2: Open VBA Window
Now we will open the VBA window in the workbook.
- First, go to the Developer tab.
- Then, select Visual Basic from the Code group.
- Afterward, you will see the Visual Basic window appear.
Read More: How to Use Spell Number in Excel
Step 3: Insert Module
At this stage, we will create the location for inserting the code.
- In the Visual Basic window, go to the Insert tab.
- Here, select Module from the drop-down menu.
- Following, you will see a blank page on the left.
Read More: How to Convert Number to Words in Excel
Step 4: Apply VBA Code
Finally, let us insert the VBA code.
- First, select the code below.
- Then, press Ctrl + C on your keyboard to copy the code.
- Afterward, go to the Module window.
- Following, press Ctrl + V to paste the code.
Public Function SpellTaka(SpNum As String)
Dim yDP As Integer
Dim yArr As Variant
Dim yR_Paisa As String
Dim yNum As String
Dim yF As Integer
Dim yTemp As String
Dim yStr As String
Dim yR As String
Dim yLp As Integer
yArr = Array("", "", " Thousand ", " Lacs ", " Crores ", " Trillion ", "", "", "", "")
On Error Resume Next
If SpNum = "" Then
SpellTaka = ""
Exit Function
End If
yNum = Trim(Str(SpNum))
If yNum = "" Then
SpellTaka = ""
Exit Function
End If
yR = ""
yLp = 0
If (yNum > 999999999.99) Then
SpellTaka = "Exceeds Max limit"
Exit Function
End If
yDP = InStr(yNum, ".")
If yDP > 0 Then
If (Len(yNum) - yDP) = 1 Then
yR_Paisa = SpellTaka_GetT(Left(Mid(yNum, yDP + 1) & "0", 2))
ElseIf (Len(yNum) - yDP) > 1 Then
yR_Paisa = SpellTaka_GetT(Left(Mid(yNum, yDP + 1), 2))
End If
yNum = Trim(Left(yNum, yDP - 1))
End If
yF = 1
Do While yNum <> ""
If (yF >= 2) Then
yTemp = Right(yNum, 2)
Else
If (Len(yNum) = 2) Then
yTemp = Right(yNum, 2)
ElseIf (Len(yNum) = 1) Then
yTemp = Right(yNum, 1)
Else
yTemp = Right(yNum, 3)
End If
End If
yStr = ""
If Val(yTemp) > 99 Then
yStr = SpellTaka_GetH(Right(yTemp, 3), yLp)
If Right(Trim(yStr), 3) <> "Lac" Then
yLp = yLp + 1
End If
ElseIf Val(yTemp) <= 99 And Val(yTemp) > 9 Then
yStr = SpellTaka_GetT(Right(yTemp, 2))
ElseIf Val(yTemp) < 10 Then
yStr = SpellTaka_GetD(Right(yTemp, 2))
End If
If yStr <> "" Then
yR = yStr & yArr(yF) & yR
End If
If yF = 2 Then
If Len(yNum) = 1 Then
yNum = ""
Else
yNum = Left(yNum, Len(yNum) - 2)
End If
ElseIf yF = 3 Then
If Len(yNum) >= 3 Then
yNum = Left(yNum, Len(yNum) - 2)
Else
yNum = ""
End If
ElseIf yF = 4 Then
yNum = ""
Else
If Len(yNum) <= 2 Then
yNum = ""
Else
yNum = Left(yNum, Len(yNum) - 3)
End If
End If
yF = yF + 1
Loop
If yR = "" Then
yR = "No Taka"
Else
yR = yR & " Taka "
End If
If yR_Paisa <> "" Then
yR_Paisa = "and " & yR_Paisa & " Paisa"
End If
SpellTaka = yR & yR_Paisa & " Only"
End Function
Function SpellTaka_GetH(yStrH As String, yLp As Integer)
Dim yR As String
If Val(yStrH) < 1 Then
SpellTaka_GetH = ""
Exit Function
Else
yStrH = Right("000" & yStrH, 3)
If Mid(yStrH, 1, 1) <> "0" Then
If (yLp > 0) Then
yR = SpellTaka_GetD(Mid(yStrH, 1, 1)) & " Lac "
Else
yR = SpellTaka_GetD(Mid(yStrH, 1, 1)) & " Hundred "
End If
End If
If Mid(yStrH, 2, 1) <> "0" Then
yR = yR & SpellTaka_GetT(Mid(yStrH, 2))
Else
yR = yR & SpellTaka_GetD(Mid(yStrH, 3))
End If
End If
SpellTaka_GetH = yR
End Function
Function SpellTaka_GetT(yTStr As String)
Dim yTArr1 As Variant
Dim yTArr2 As Variant
Dim yR As String
yTArr1 = Array("Ten", "Eleven", "Twelve", "Thirteen", "Fourteen", "Fifteen", "Sixteen", "Seventeen", "Eighteen", "Nineteen")
yTArr2 = Array("", "Twenty", "Thirty", "Forty", "Fifty", "Sixty", "Seventy", "Eighty", "Ninety")
Result = ""
If Val(Left(yTStr, 1)) = 1 Then
yR = yTArr1(Val(Mid(yTStr, 2, 1)))
Else
If Val(Left(yTStr, 1)) > 0 Then
yR = yTArr2(Val(Left(yTStr, 1)) - 1)
End If
yR = yR & SpellTaka_GetD(Right(yTStr, 1))
End If
SpellTaka_GetT = yR
End Function
Function SpellTaka_GetD(yDStr As String)
Dim yArr_1() As Variant
yArr_1 = Array(" One", " Two", " Three", " Four", " Five", " Six", " Seven", " Eight", " Nine", "")
If Val(yDStr) > 0 Then
SpellTaka_GetD = yArr_1(Val(yDStr) - 1)
Else
SpellTaka_GetD = ""
End If
End Function
- Next, press the Save button and close the window.
Similar Readings
- How to Convert Number to Words in Excel Without VBA
- How to Convert Number to Words in Excel in Rupees
- How to Convert Peso Number to Words in Excel
Step 5: Input Function to Spell Number in Taka
We are at our final stage to spell the numbers in taka from our dataset.
- First, select cell C5.
- Here, insert this formula in this cell.
=SpellTaka(B5)
- Then, press Enter.
- That’s it, you will see the first output where the number is spelled into words.
- Lastly, use the AutoFill tool and you will get results in cell range C6:C9.
Download Practice Workbook
Download this sample file and practice by yourself.
Conclusion
In conclusion, I hope that it was a helpful article for you on how to spell the number in Excel in taka with easy steps. Get the sample file and explore. Also, let us know more solutions to this. Looking forward to your insightful suggestions.
Its Worked. Thank you very much for the post
Dear Md. Morshed Alam,
You are most welcome.
Regards
ExcelDemy