Excel VBA - Number to Text Function Watch More Videos at: www.tutorialsp... Lecture By: Mr. Pavan Lalwani Tutorials Point India Private Limited
Пікірлер: 174
@PavanLalwani6 жыл бұрын
Function IntToString(amt As Variant) As Variant Dim FIGURE As Variant Dim LENFIG As Integer Dim i As Integer Dim Str(19) As String Dim tens(9) As String Str(1) = "One" Str(2) = "Two" Str(3) = "Three" Str(4) = "Four" Str(5) = "Five" Str(6) = "Six" Str(7) = "Seven" Str(8) = "Eight" Str(9) = "Nine" Str(10) = "Ten" Str(11) = "Eleven" Str(12) = "Twelve" Str(13) = "Thirteen" Str(14) = "Forteen" Str(15) = "Fifteen" Str(16) = "Sixteen" Str(17) = "Seventeen" Str(18) = "Eighteen" Str(19) = "Nineteen" tens(2) = "Twenty" tens(3) = "Thirty" tens(4) = "Forty" tens(5) = "Fifty" tens(6) = "Sixty" tens(7) = "Seventy" tens(8) = "Eighty" tens(9) = "Ninety" FIGURE = amt FIGURE = Format(FIGURE, "FIXED") FIGLEN = Len(FIGURE) If FIGLEN < 12 Then FIGURE = Space(12 - FIGLEN) & FIGURE End If If Val(Left(FIGURE, 9)) > 1 Then IntToString = "Rupees " ElseIf Val(Left(FIGURE, 9)) = 1 Then IntToString = "Rupee " End If For i = 1 To 3 If Val(Left(FIGURE, 2)) < 20 And Val(Left(FIGURE, 2)) > 0 Then IntToString = IntToString & Str(Val(Left(FIGURE, 2))) ElseIf Val(Left(FIGURE, 2)) > 19 Then IntToString = IntToString & tens(Val(Left(FIGURE, 1))) IntToString = IntToString & Str(Val(Right(Left(FIGURE, 2), 1))) End If If i = 1 And Val(Left(FIGURE, 2)) > 0 Then IntToString = IntToString & " Crore " ElseIf i = 2 And Val(Left(FIGURE, 2)) > 0 Then IntToString = IntToString & " Lakh " ElseIf i = 3 And Val(Left(FIGURE, 2)) > 0 Then IntToString = IntToString & " Thousand " End If FIGURE = Mid(FIGURE, 3) Next i If Val(Left(FIGURE, 1)) > 0 Then IntToString = IntToString & Str(Val(Left(FIGURE, 1))) + " Hundred " End If FIGURE = Mid(FIGURE, 2) If Val(Left(FIGURE, 2)) < 20 And Val(Left(FIGURE, 2)) > 0 Then IntToString = IntToString & Str(Val(Left(FIGURE, 2))) ElseIf Val(Left(FIGURE, 2)) > 19 Then IntToString = IntToString & " " & tens(Val(Left(FIGURE, 1))) IntToString = IntToString & " " & Str(Val(Right(Left(FIGURE, 2), 1))) End If FIGURE = Mid(FIGURE, 4) If Val(FIGURE) > 0 Then IntToString = IntToString & " Paise " If Val(Left(FIGURE, 2)) < 20 And Val(Left(FIGURE, 2)) > 0 Then IntToString = IntToString & Str(Val(Left(FIGURE, 2))) ElseIf Val(Left(FIGURE, 2)) > 19 Then IntToString = IntToString & " " & tens(Val(Left(FIGURE, 1))) IntToString = IntToString & " " & Str(Val(Right(Left(FIGURE, 2), 1))) End If End If FIGURE = amt FIGURE = Format(FIGURE, "FIXED") If Val(FIGURE) > 0 Then IntToString = IntToString & " Only " End If End Function
@bankornheng4025 жыл бұрын
I would like to obtain you code, How could i get it?
@wmfield1524 жыл бұрын
Which one of these courses am I to buy in order to get the numbers to text code?
@MrBhopinderkumar6 жыл бұрын
Nice explain Thanks
@favoratekochar95552 жыл бұрын
Please guide how can we write self..instead for copy paste
@sureshrao81162 жыл бұрын
am searching no notepad file is not in below the this file
@SameerGoyal-su9cx11 ай бұрын
where is the notepad file?
@seherhashim72936 жыл бұрын
Hi. I cannot find the file attached. Can you please attach the file with the code. Thank you
@chiranjeetsarkar8917 ай бұрын
I also tried to find it, but can not see it.
@cpacharya32143 жыл бұрын
What the hell is all this, can't you just arrange all the videos in chronologically. And from where do I get that lengthy code. Is that gonna come to my computer's notepad automatically 😡😡😡
@sainathdhampalwar5 жыл бұрын
all videos very nice..... i am not finding any notepad attachment.....plz share the same
@vijayverma85159 ай бұрын
Function ConvertToText(number As Double) As String Dim units As Variant Dim tens As Variant Dim ones As Variant Dim result As String ' Define arrays for units, tens, and ones places units = Array("", "One", "Two", "Three", "Four", "Five", "Six", "Seven", "Eight", "Nine") tens = Array("", "Ten", "Twenty", "Thirty", "Forty", "Fifty", "Sixty", "Seventy", "Eighty", "Ninety") ones = Array("", "Eleven", "Twelve", "Thirteen", "Fourteen", "Fifteen", "Sixteen", "Seventeen", "Eighteen", "Nineteen") ' Check if the number is zero If number = 0 Then ConvertToText = "Zero" Exit Function End If ' Extract digits from the number Dim hundredsDigit As Integer Dim tensDigit As Integer Dim onesDigit As Integer hundredsDigit = Int((number Mod 1000) / 100) tensDigit = Int((number Mod 100) / 10) onesDigit = Int(number Mod 10) ' Convert hundreds place to text If hundredsDigit > 0 Then result = units(hundredsDigit) & " Hundred" End If ' Convert tens and ones places to text If tensDigit > 1 Then result = result & " " & tens(tensDigit) If onesDigit > 0 Then result = result & " " & units(onesDigit) End If ElseIf tensDigit = 1 Then result = result & " " & ones(onesDigit) ElseIf onesDigit > 0 Then result = result & " " & units(onesDigit) End If ' Trim leading and trailing spaces ConvertToText = Trim(result) End Function You can also generate this code from Chat GPT.
@georgeregoo4 жыл бұрын
WHY can't you give the lesson in indian rupees instead of us dollars? this vba code is lifted of mirosoft vba webhelp
@tariqkhan74473 жыл бұрын
Many thanks. Could you please let me know how to get amount in words like one lac rupees or eight lac.
@girishhn66406 ай бұрын
I couldn't able to find the attached notepad, please share the like
@nabinbhurtel93694 жыл бұрын
You can find the code to convert numbers to text in following Website. www.myonlinetraininghub.com/convert-numbers-currency-to-words-with-excel-vba
@tanmoyroy15054 жыл бұрын
Thank you Nabin.
@akashprasad14484 жыл бұрын
Are yaar hindi bolte to kuchh bigar nahi jata. Hindi video banaoge to jyada like,view aur subscribers rahenge.
@NishantSingh-qf4bf3 жыл бұрын
Sir mine is showing compile eror Expected:expression and sir when I put second formula it is showing "#NAME? "
@arthurreynolds663810 ай бұрын
Where can I find this code to copy?
@DedeSews5 жыл бұрын
I am getting an error at the line: Cents = GetTens(Left(Mid(MyNumber, DecimalPlace + 1) & _ "00", 2)) The error says "Compile error: Syntax error" Do you have any suggestions?
@Nxby.Szyslak5 жыл бұрын
I have the same message!😣
@domainrajud63414 жыл бұрын
use the below script ------------------------------------------ Option Explicit 'Main Function Function SpellNumber(ByVal MyNumber) Dim Dollars, Cents, Temp Dim DecimalPlace, Count 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 cents and set MyNumber to dollar amount. If DecimalPlace > 0 Then Cents = GetTens(Left(Mid(MyNumber, DecimalPlace + 1) & _ "00", 2)) MyNumber = Trim(Left(MyNumber, DecimalPlace - 1)) End If Count = 1 Do While MyNumber "" Temp = GetHundreds(Right(MyNumber, 3)) If Temp "" Then Dollars = Temp & Place(Count) & Dollars If Len(MyNumber) > 3 Then MyNumber = Left(MyNumber, Len(MyNumber) - 3) Else MyNumber = "" End If Count = Count + 1 Loop Select Case Dollars Case "" Dollars = "Zero Dollars" Case "One" Dollars = "One Dollar" Case Else Dollars = Dollars & " Dollars" End Select Select Case Cents Case "" Cents = " and Zero Cents" Case "One" Cents = " and One Cent" Case Else Cents = " and " & Cents & " Cents" End Select SpellNumber = Dollars & Cents 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
@ruchirmohan21584 жыл бұрын
@@domainrajud6341 thanks bro !!
@vikassethi12404 жыл бұрын
@@domainrajud6341 Thanks dear
@zahoorsarbandi2982 Жыл бұрын
@@domainrajud6341 Thank you very much
@ramyavasanth13986 жыл бұрын
i couldnt find any attachment
@hrishikeshchaudhari24564 жыл бұрын
Please share VBA code notepad
@shaykh_dubai4 жыл бұрын
I couldn't find the file on your website 😭
@bikashkalita43174 ай бұрын
But i want it on Indian currency
@abduls73014 жыл бұрын
where is the number t o text code? please ?
@commanderwondwossen85894 жыл бұрын
where is the notepad.please attach it
@alextjohn18 ай бұрын
Sir... I need your help. i need to change Doller and cents change Indian rupees and paisa . How it is possible? "Indian Rupees" how it's come? can you pls explain me
@boomideviravishankar8574 жыл бұрын
where is the notepad which you have written the code?
@bvkksprakasaraju49934 жыл бұрын
Dear Mr Pawan please show where is the note pad to download to copy spell program explaining every minute thing very patiently excellent teaching skill Thank you
@anamkounain22893 ай бұрын
Can u give the code
@rakeshgoud_hi4 жыл бұрын
Hi Sir, I am unable to find the attachment...please advice
@HaseebMirza-f8y5 ай бұрын
Sir Where can we find the code that you copy pasted . i understood what you did but i believe that was just copy pasting
@yogeshbhatt91902 жыл бұрын
Number to text code is missing. I think it has been removed by Pawan. U don't do what u say.. Very poor.
@RSJSqUaD2 жыл бұрын
Hi Sir, Could you please send me this notepad codings of number to text function. You're standing in the video hiding the codings
@sureshraveendran5972 Жыл бұрын
hai sir our excel data base file is in server and it is not converting to numbers it shows on warning "SECURITY RISK Micosoft has blocked macros from running because the source of this file is untrusted" please advise what to do for this
@himanshudohare6726 Жыл бұрын
Hello Sir. Thanks for this wonderful playlist. I am not able to the find the note pad file. could you please provide the same.
@michelquoirin23332 жыл бұрын
Thank you so much for your very educative playlist. In your previous video with immediate Window, i changed the name Sheet by worksheet and it worked . Practising each of your tutorials is divine
@tesorointeriors40002 жыл бұрын
Thank you so much , But not able to find the Code in Notepad as you said. will you share me the notepad.. Please..
@ramanajami40382 жыл бұрын
Thank you so much , But not able to find the Code in Notepad as you said. will you share me the notepad
@tegaivwighre471611 ай бұрын
Please paste the link to download Number to text function
@Deepratan272 жыл бұрын
It's working only single open file, if again open fresh excel it's not working
@saineeli4593 Жыл бұрын
Pleas send the link to download this program ..I need to know the number to text code video
@anilkumarganan Жыл бұрын
Vba code de do
@PetrolGasoil8 ай бұрын
Hi sir te link to the code is not available below the video can you please update
@saineeli4593 Жыл бұрын
Your way of teach is good ..thank you..and can u share the link about number to text the program.(I need coding about number convert to text),please
@manishmanny22402 жыл бұрын
Please attached this convert Module code.....Thank you... your all video is easy to understand ...
@nazarabbas69563 жыл бұрын
Where is the notepad which you have shared? After clicking link I have visit your page but I don't have found so tell me about exact location into the page. Thanks
@Narenclip3 жыл бұрын
code copying is easy better teach the vba code step wise....
@laimichael244010 ай бұрын
how can i use the same functions across other workbook? tks!
@johnsonm.v87412 жыл бұрын
Hi, Thank you for your tutorial. Whereas can I have the code so that I can copy. Please help
@biccbirgunj59233 жыл бұрын
Will you help to convert the following in excel eg. number format $145.00 into Text format $145.00
@sanjeevthakur89104 жыл бұрын
What you didnt tell how to convert Dollars to rupees..and cent to paise...
@harshabandaru63213 жыл бұрын
There is no code attached from your video reference bro...
@satheeshraju7162 жыл бұрын
how can convert dollars to rupees..
@firstdealtradingcontractin27242 жыл бұрын
How to put the word "only" at the end of the amount.
@hijratsail5812 жыл бұрын
I cant received any attached here can you help me
@umeshlangade92316 жыл бұрын
Hello, There is no attachment, kindly share.
@singhsk914 жыл бұрын
Option Explicit 'Main Function Function SpellNumber(ByVal MyNumber) Dim Dollars, Cents, Temp Dim DecimalPlace, Count 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 cents and set MyNumber to dollar amount. If DecimalPlace > 0 Then Cents = GetTens(Left(Mid(MyNumber, DecimalPlace + 1) & _ "00", 2)) MyNumber = Trim(Left(MyNumber, DecimalPlace - 1)) End If Count = 1 Do While MyNumber "" Temp = GetHundreds(Right(MyNumber, 3)) If Temp "" Then Dollars = Temp & Place(Count) & Dollars If Len(MyNumber) > 3 Then MyNumber = Left(MyNumber, Len(MyNumber) - 3) Else MyNumber = "" End If Count = Count + 1 Loop Select Case Dollars Case "" Dollars = "No Dollars" Case "One" Dollars = "One Dollar" Case Else Dollars = Dollars & " Dollars" End Select Select Case Cents Case "" Cents = " and No Cents" Case "One" Cents = " and One Cent" Case Else Cents = " and " & Cents & " Cents" End Select SpellNumber = Dollars & Cents 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 Copy and paste in module. do it. Function SpellNumber
@Ypushphakumar4 ай бұрын
@@singhsk91 Thankyou so much sir
@aravaanent16542 жыл бұрын
can you share file for kenya shillings
@finance_talks_with_shikha Жыл бұрын
i couldn't fine the notepad file
@ef74965 жыл бұрын
Hi , thank you so much for such a useful video, Can you please make a video about how to covert any word to numbers? I am assuming it should be binary numbers or whatever you think it will work.
@adhithyagovindasamy1675 Жыл бұрын
Where can I get this code...?
@dineshgajbhiye95073 жыл бұрын
Pls share the notepad for number to text macro
@KamalVasudeva-s8d Жыл бұрын
good description where is the code
@subbaraogun51654 жыл бұрын
Any one help whare you get note pad I am unable to see
@aashishsaxena37204 жыл бұрын
Dear need help on formatting a Textbox for a form , of First three alpha, last two numbers separated by a "-" , somewhat (a,a,a,"-" ,n,n) with length of 6
@aashishsaxena37204 жыл бұрын
hv tried ([A-Z]{1,3},"-",[0-9][0-9]
@chiragdixit71782 жыл бұрын
i can not find the attached notpad file
@yuvrajprajapati65493 жыл бұрын
I couldn't find the developer option
@sureshrao81162 жыл бұрын
am waiting for ur reply
@Sayanerzee2 жыл бұрын
Sir, where is the notepad??????
@sagarmicrosoftoffice1225 Жыл бұрын
I didn't get that notepad file
@burhanshah58552 жыл бұрын
Where is the notepad file ?
@khimsoda8433 жыл бұрын
can you help me I can spell my language
@tessbuba59653 жыл бұрын
Hi, how to replace Dollars to Peso or to use USD instead? Please notice this comment. Thanks a lot.
@seemakaushal22124 жыл бұрын
where is the code notepad , din find please help
@prakashpurohit47814 жыл бұрын
दो हज़ार तीन सौ एक कैसे लिखें ये हिंदी में भी करदे तो मज़ा आ जाये
@jaykukreja86004 жыл бұрын
Not able to see any attachment
@surajyadav-jk4ni4 жыл бұрын
Can I get number to text notepad please
@mukeshkumar-ch6jg4 жыл бұрын
ReDim place(9) As String line compile error can't find project or library in excel 2010
@shafeekabds30344 жыл бұрын
could you please provide the Attachment ? i couldn't find the same here
@patilpatil82624 жыл бұрын
where is the code in notepad????????? not found in a video description.
@muhammadkhalil57122 жыл бұрын
Hi, sir appreciated ♥️ Sir I think you did not mention the code..from where we can copy the code..? Thanks
@archi19892 жыл бұрын
Can you please upload the formula format. It will be really helpful. Thankyou.
@Arash_MMA_News Жыл бұрын
Tell me The code
@filtrontechniques54884 жыл бұрын
sir....where is the notepad coding
@nikitasharma56049 ай бұрын
From where did you get this code please reply
@chiranjeetsarkar8917 ай бұрын
No code found, I also checked didi 😊😊
@Vishalsharma-xj3ej4 жыл бұрын
How to change currency type from dollar to rupees? Please explain
@manjunathseeri28993 жыл бұрын
Sir Indian rupee
@adegbulu15 жыл бұрын
Like seriously, I did not see ant attachment here.
@sethumadhavan3754 жыл бұрын
Please attach the Notepad mentioned in the video.
@alkaamin6604 жыл бұрын
I don't see the Notepad file as said in the video. Do I have to pay for it or be a member.
@rajkumarpalle8217 Жыл бұрын
Its was nice explaination.. and nice video. Thank you sir.
@nishkarshkoche9218 Жыл бұрын
I didn't got the code can u help me where to find it. It is not given in the description?
@hamzamushtaq77904 жыл бұрын
Brother how can i get note pad file.?
@snnsr33 жыл бұрын
will you please share this code with us ?
@baruwacampus18383 жыл бұрын
would you provide vb codes to convert numbers upto 50 only?
@harahotta5 жыл бұрын
This menu is not in regular Excel Is it only exist in Professional version?
@Nxby.Szyslak5 жыл бұрын
Any help please ! I have this message on my screen Error of compilation Variable not defineted And the word "cents" is selected on virtual basic. What can I do?
@VenkateshB230643 жыл бұрын
Can you please explain this above code in detail in another video?
@gunadmtdomains4 жыл бұрын
No attachment is here please share me.
@hemantgoyal4094 жыл бұрын
Hello sir ..how I can search names in my database with same sounding and different spelling..like John and Jon.. Deepak and dipak..please guide
@saran21354 жыл бұрын
Can you please share the notepad code again we r unable to view