How to Convert Number to Words in Excel in Rupees in Windows 10
Ever found yourself needing to convert numbers to words in Excel, specifically for rupees, and wondered how to do it? It’s not as complicated as you might think! In just a few easy steps, you can set up a custom function in Excel on your Windows 10 computer to automatically convert numerical figures into words. Ready to get started? Let’s dive in.
How to Convert Number to Words in Excel in Rupees in Windows 10
In this section, we will walk through the steps needed to convert numbers to words in Excel for rupees. These steps will help you create a macro that you can use whenever you need to make this conversion.
Step 1: Open Excel and Press Alt + F11
To start, open Excel and press the Alt + F11 keys simultaneously to open the Visual Basic for Applications (VBA) editor.
The VBA editor is a powerful tool that allows you to create macros and custom functions. Don’t worry if it looks a bit intimidating at first; we’ll guide you through it.
Step 2: Insert a New Module
In the VBA editor, go to the Insert menu and click on Module.
Inserting a new module will create a space where you can write your custom function. Think of it like a blank canvas where you can paint your solution.
Step 3: Copy and Paste the Function Code
Next, copy the following VBA code and paste it into the new module:
Function NumberToWords(ByVal MyNumber)
Dim Units As String
Dim DecimalPlace As Integer, Count As Integer
ReDim Place(9) As String
Place(2) = " Thousand "
Place(3) = " Lakh "
Place(4) = " Crore "
' Convert MyNumber to string and Trim white space
MyNumber = Trim(CStr(MyNumber))
' Find Position of decimal place
DecimalPlace = InStr(MyNumber, ".")
' Convert Paise and set MyNumber to Rupees amount
If DecimalPlace > 0 Then
Units = 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 NumberToWords = Temp & Place(Count) & NumberToWords
If Count = 1 Then MyNumber = Left(MyNumber, Len(MyNumber) - 3)
If Count > 1 Then MyNumber = Left(MyNumber, Len(MyNumber) - 2)
Count = Count + 1
Loop
NumberToWords = Application.Trim(NumberToWords) & " Rupees"
If Units "" Then NumberToWords = NumberToWords & " and " & Units & " Paise"
End Function
Private 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
Private Function GetTens(TensText)
Dim Result As String
Result = ""
If Val(Left(TensText, 1)) = 1 Then
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
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))
End If
GetTens = Result
End Function
Private 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
This code includes a custom function called NumberToWords
that converts numeric values to words in rupees and paise.
Step 4: Save and Close the VBA Editor
Once you’ve pasted the code, save your work by pressing Ctrl + S, then close the VBA editor by pressing the X in the top-right corner or Alt + Q.
You should now be back in Excel, and your custom function is ready to use.
Step 5: Use the Custom Function in Excel
Now, go back to your Excel sheet and in any cell, type =NumberToWords(A1)
, replacing A1 with the cell that contains the number you want to convert.
This formula will call your custom function and display the number in words.
After completing these steps, whenever you enter a number in the specified cell, Excel will automatically convert it to words in rupees and paise!
Tips for Converting Number to Words in Excel in Rupees in Windows 10
- Always make a backup of your Excel file before adding VBA code.
- Use descriptive names for your modules and functions to easily identify them later.
- Test the function with different values to ensure accuracy.
- If you encounter an error, double-check the code for any typos or missed steps.
- Consider adding comments in your VBA code to explain what each section does; this is helpful for future reference.
Frequently Asked Questions
What is VBA?
VBA stands for Visual Basic for Applications. It’s a programming language used in Microsoft Excel to create custom functions and automate tasks.
Can I use this function for other currencies?
Yes, but you’ll need to modify the place values and currency names in the code to match the currency you want to use.
Will this function work on a Mac?
This code is designed for Windows, but it can work on a Mac if you have the VBA editor enabled in Excel for Mac.
Can I add more place values like millions or billions?
Definitely! You can modify the Place
array in the VBA code to include additional place values.
How do I debug if the function isn’t working?
Check for common issues like typos in the code, missing lines, or incorrect cell references in your Excel sheet.
Summary
- Open Excel and Press Alt + F11.
- Insert a New Module.
- Copy and Paste the Function Code.
- Save and Close the VBA Editor.
- Use the Custom Function in Excel.
Conclusion
Converting numbers to words in Excel in rupees on Windows 10 isn’t as daunting as it might seem at first glance. With a little bit of VBA magic, you can automate this task and save yourself a ton of time. Follow the steps we’ve outlined, and you’ll be able to create a custom function that converts numbers into words in rupees and paise effortlessly.
Once you’ve got the hang of it, the possibilities for automation in Excel are endless. You can customize and expand this function to suit your specific needs, making your work more efficient and accurate. Don’t be afraid to explore and experiment with VBA; it’s a powerful tool that can significantly enhance your productivity.
So, why not give it a try? Dive into the world of Excel VBA and start converting numbers to words in rupees today. Happy coding!
Matt Jacobs has been working as an IT consultant for small businesses since receiving his Master’s degree in 2003. While he still does some consulting work, his primary focus now is on creating technology support content for SupportYourTech.com.
His work can be found on many websites and focuses on topics such as Microsoft Office, Apple devices, Android devices, Photoshop, and more.