MS Excel এ অটো ইনোয়ার্ড, যেমন ১০০ লিখলে One Hundred

টিটিতে আমার এটি প্রথম টিউন..........ছোট-খাটো ত্রুটিগুলি ক্ষমাসুন্দর দৃষ্টিতে দেখবেন আশা করি............

প্রথমেই বলে নিই আমার এ লেখাটি আমার নামেই প্রথম আলোর কম্পিউটার প্রতিদিন কলামে ছাপা হয়েছিল তিনদিন তিন কিস্তিতে। তাই নিজের লিখা নিজেই এখানে টিউন করাতে টিটি কর্তৃপক্ষের কোন আপত্তি নেই ধরে নিচ্ছি।..............কাজের কথাই আসি এবার...............

MS Excel অনেকেই অনেকদিন ধরে ব্যবহার করে আসলেও একটা ব্যাপার সম্ভবত অনেকেরেই জানা নেই, তা হলো কিভাবে MS Excel এ Numeric থেকে Inword হবে। অর্থাৎ আপনি  100.50 টাইপ করলে তা দেখাবে One Hundred Taka and Paisa Fifty.   নিচের ধাপগুলো অনুসরণ করে সহজেই তা করা যাবে। প্রথমেই নিচের কোড গুলো Copy করে রাখুন।

এখানে ক্লিক করে প্রাপ্ত কোডগুলি কপি করে রাখুন

এরপর MS Excel চালু করুন। যে কোন একটি শীট সেভ করুন। এখন MS Excel চালু অবস্থায় Press করুন : Alt+F11   এরপর Insert মেনু থেকে Module এ কিক করুন।নতুন উইন্ডো আসবে।

ফাঁকা স্পেসে আগে থেকে কপি করা কোডগুলি Paste করুন।

Save এ কিক করে MS Excel থেকে বের হয়ে আসুন। এখন আবার সেভ করা শীটটি চালু করুন।  প্রথমে A1 Cell এ টাইপ করুন 100.50  ।  এর পর A1 Cell  ছাড়া অন্য যে কোন Cell এ এই ফর্মূলা টাইপ করুন :  =SpellNumber(A1) এখন লক্ষ্য করুন আপনার ফর্মূলার জায়গায় হয়ে গেছে One Hundred Taka and Paisa Fifty.

     

Level New

আমি আরমান। বিশ্বের সর্ববৃহৎ বিজ্ঞান ও প্রযুক্তির সৌশল নেটওয়ার্ক - টেকটিউনস এ আমি 12 বছর 6 মাস যাবৎ যুক্ত আছি। টেকটিউনস আমি এ পর্যন্ত 17 টি টিউন ও 245 টি টিউমেন্ট করেছি। টেকটিউনসে আমার 1 ফলোয়ার আছে এবং আমি টেকটিউনসে 0 টিউনারকে ফলো করি।

Jackle of all trades master of none.


টিউনস


আরও টিউনস


টিউনারের আরও টিউনস


টিউমেন্টস

ভাই, আসতেছে না।
যেই cell এ =SpellNumber(A1) টাইপ করি সেখানে আসে #NAME?

Level 0

জটিল একটি টিউন।আশা করি সবার পছন্দ হবে।

Level 0

kaj hoy nai….emni emni kosto korlam…..

@দার্শনিক নূর । আমি আমার পিসিতে আবারো ট্রাই করলাম। ঠিক আছে। আপনার জন্য পরামর্শ –

১। কোডগুলোর দুই লাইনের মাঝে যে গ্যাপ আছে তা ডিলিট করে দিন। এজন্য এমএস ওয়ার্ডে কোডগুলি পেস্ট করে Ctrl+A চেপে সব সিলেক্ট করে Ctrl+1 চাপুন (Numeric pad থেকে নয়, Q এর উপরে যে 1 আছে সেটা) ।

২। আপনি যদি Kaspersky ব্যবহার করেন তাহলে, সেটিংস থেকে Application Control এর টিক চিন্হ টি উঠিয়ে দিন। কাজ হলে আবার এনাবেল করে দিবেন। আশাকরি কাজ হবে।

@Nishir আপনার ই-মেইল এড্রেস দেন , আমি একটা এক্সেল শিট পাঠিয়ে দেব। ……..

I checked this function, but I want in words with Lakh(s) and crore, Please write code for lakhs

    @Hasan_Ahmed-

    ঠিক আছে…..কোড লিখা হলে এখানেই আপডেট দিয়ে দিব।

thanks for reply and I am waiting for this code

we can convert in Lakhs and crore the following code :

Function SpellNumber(ByVal MyNumber, Optional incTaka As Boolean = True)
Dim Crores, Lakhs, Taka, Paise, Temp
Dim DecimalPlace As Long, Count As Long
Dim myLakhs, myCrores
ReDim Place(9) As String
Place(2) = ” Thousand “: Place(3) = ” Million ”
Place(4) = ” Billion “: Place(5) = ” Trillion ”
‘ String representation of amount.
MyNumber = Trim(Str(MyNumber))
‘ Position of decimal place 0 if none.
DecimalPlace = InStr(MyNumber, “.”)
‘ Convert Paise and set MyNumber to Taka amount.
If DecimalPlace > 0 Then
Paise = GetTens(Left(Mid(MyNumber, DecimalPlace + 1) & “00”, 2))
MyNumber = Trim(Left(MyNumber, DecimalPlace – 1))
End If
myCrores = MyNumber \ 10000000
myLakhs = (MyNumber – myCrores * 10000000) \ 100000
MyNumber = MyNumber – myCrores * 10000000 – myLakhs * 100000
Count = 1
Do While myCrores “”
Temp = GetHundreds(Right(myCrores, 3))
If Temp “” Then Crores = Temp & Place(Count) & Crores
If Len(myCrores) > 3 Then
myCrores = Left(myCrores, Len(myCrores) – 3)
Else
myCrores = “”
End If
Count = Count + 1
Loop
Count = 1
Do While myLakhs “”
Temp = GetHundreds(Right(myLakhs, 3))
If Temp “” Then Lakhs = Temp & Place(Count) & Lakhs
If Len(myLakhs) > 3 Then
myLakhs = Left(myLakhs, Len(myLakhs) – 3)
Else
myLakhs = “”
End If
Count = Count + 1
Loop
Count = 1
Do While MyNumber “”
Temp = GetHundreds(Right(MyNumber, 3))
If Temp “” Then Taka = Temp & Place(Count) & Taka
If Len(MyNumber) > 3 Then
MyNumber = Left(MyNumber, Len(MyNumber) – 3)
Else
MyNumber = “”
End If
Count = Count + 1
Loop
Select Case Crores
Case “”: Crores = “”
Case “One”: Crores = ” One Crore ”
Case Else: Crores = Crores & ” Crores ”
End Select
Select Case Lakhs
Case “”: Lakhs = “”
Case “One”: Lakhs = ” One Lakh ”
Case Else: Lakhs = Lakhs & ” Lakhs ”
End Select
Select Case Taka
Case “One”: Taka = “One ”
Case Else:

Taka = Taka
End Select
Select Case Paise
Case “”: Paise = ” and Paise Zero Only ”
Case “One”: Paise = ” and Paise One Only ”
Case Else: Paise = ” and Paise ” & Paise & ” Only ”
End Select
SpellNumber = IIf(incTaka, “Taka “, “”) & Crores & _
Lakhs & Taka & Paise
End Function
‘ Converts a number from 100-999 into text
Function GetHundreds(ByVal MyNumber)
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
‘ Converts a number from 10 to 99 into text.
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
‘ Converts a number from 1 to 9 into text.
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

@Hasan_Ahmed এটা কি আপনি নিজে টেস্ট করেছেন ? মনে হয় কিছু বাগ আছে।

I checked it and not found bug. I sent your mail sample file for test.

I sent a sample file for test, where is no error,

স্বাগতম আপনাকে টেকটিউনসে, প্রথম টিউন হলেও বেশ ভালো করেছেন… আগামী দিনগুলোর জন্যে শুভকামনা রইলো…

@ডিজে আরিফ ; Thanx

Level 0

ভাই আপনার নিরদেস অনুজাই বেশ কয়েকবার চেষ্টা করলাম।
কাজ হয়না
আরও কোন ত্রুটি ধরা পরলে জানাবেন।
আমি ব্যার্থ।
JK. Asad
01918 190694
[email protected]

কোন ত্রুটি নাই। Download sample Excel sheet

Level 0

khub valo hoyese , tobe vaiya code gula ki joto ber new excel sheet a kaj korbo sob somoy ki
arokom paste kore nite hobe , plz jala le onek khushi hobo , Thanx ai post dawar jonno.

Level 0

Thanks. really healpfull.

যারা করতে পারেননি তারা ফাইল সেইভ করার সময় ফাইল টাইপ বা Save as Type এ Excel macro-enabled workbook সিলেক্ট করে দেখতে পারেন।

Dear Tayfur Rahaman and Arman bhai, some error show in code ,which paste in comment box, So,I upload original code for your work , Please download and ফর্মূলা টাইপ করুন : = inwords(), Here is media fire link : if not work than contact to me 01919001939 or email : [email protected] http://www.mediafire.com/?3kuzi4hyvgqyko8

@তায়ফুর রহমান : Please download and ফর্মূলা টাইপ করুন : = inwords(), Here is media fire link : if not work than contact to me 01919001939 or email : [email protected] http://www.mediafire.com/?3kuzi4hyvgqyko8

Crores, Lakhs, Taka, Paise এর জন্য নিচের কোড গুলি ব্যবহার করতে পারেন

Option Explicit
‘Main Function
Function SpellNumber(ByVal MyNumber)
Dim Taka, Paisa, Temp
Dim DecimalPlace, Count
ReDim Place(9) As String
Place(2) = ” Thousand ”
Place(3) = ” Lac ”
Place(4) = ” Crore ”
Place(5) = ” Shatak ” ‘ String representation of amount.
MyNumber = Trim(Str(MyNumber))
‘ Position of decimal place 0 if none.
DecimalPlace = InStr(MyNumber, “.”)
‘ Convert Paisa and set MyNumber to Taka amount.
If DecimalPlace > 0 Then
Paisa = GetTens(Left(Mid(MyNumber, DecimalPlace + 1) & _
“00”, 2))
MyNumber = Trim(Left(MyNumber, DecimalPlace – 1))
End If
Count = 1
Do While MyNumber “”
If Count = 1 Then Temp = GetHundreds(Right(MyNumber, 3))
If Count > 1 Then Temp = GetHundreds(Right(MyNumber, 2))
If Temp “” Then Taka = Temp & Place(Count) & Taka
If Count = 1 And Len(MyNumber) > 3 Then
MyNumber = Left(MyNumber, Len(MyNumber) – 3)
Else
If Count > 1 And Len(MyNumber) > 2 Then
MyNumber = Left(MyNumber, Len(MyNumber) – 2)
Else
MyNumber = “”
End If
End If
Count = Count + 1
Loop
Select Case Taka
Case “”
Taka = “No Taka”
Case “One”
Taka = “One Taka”
Case Else
Taka = Taka & ” Taka”
End Select
Select Case Paisa
Case “”
Paisa = ” and No Paisa”
‘Paisa = “”
Paisa = ” Only”
Case “One”
Paisa = ” and One Paisa”
Case Else
Paisa = ” and ” & Paisa & ” Paisa”
End Select
SpellNumber = Taka & Paisa
End Function
‘ Converts a number from 100-999 into text
Function GetHundreds(ByVal MyNumber)
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
‘ Converts a number from 10 to 99 into text.
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
‘ Converts a number from 1 to 9 into text.
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

Thanx Hasan Ahmed & Shamin

Level 0

অনেক বার চেস্টা করলাম ,পারলাম না

Level 0

ভাই আমি ও পারছিনা ‍email address দিলাম ‍[email protected]

sample Excel sheet এ হইনা কেন বলবেন?

Level 0

vai onek try korlam holona. plz mail to [email protected] sofol holy onek valo lagby.
thanks.01948798402

পরের অংশ টা কাজ করে না, অনেকবার চেস্টা করলাম

নাম্বার থেকে ইউএসডি তে কনভার্ট করার কোন এডইনস্‌ থাকলে শেয়ার করবেন প্লিজ।

বাংলায় স্পেল নাম্বার কারো কাছে কি অাছে?
যেমন: ১০০ লিখলে “এক শত টাকা মাত্র” হবে।
থাকলে আমাকে মেইল করুন প্লিজ [email protected]

Level 0

Excel Number to text addin
Download link- https://www.youtube.com/watch?v=hKrejwr_cus&t=4s