Friday, May 27, 2011

how to convert number to words in excel



Recently one of my readers asked me the question how to convert numeric value in to word, This is an important function everybody looking for in excel but unfortunatly there is no ready to use formula, function in excel. however  microsoft provides a visual basic function script in their support section. This script is useful for spelling number in to US dollar.
Accountinghead is converted this function script for the use of indians  with the help of some VB experts.  Letus do it with easy 5 steps , by using this script you can convert number in to indian Rupees.

  1. Download the script from here
  2. Open excel  then Press Alt+F11 to start visual basic editor
  3. In visulal basic editor click insert menu then open module
  4. Open the downloaded notpad for script, copy the script and paste in opened module window, on the left side pane  click on This work book
  5. Press Alt+Q to save the  file.
Now save the excel workbook on your hard disk. For MSoffice 2007 You need to select Save as type = Excel Macro enabled Work book. In excel 2003 you can directly save as xls file.
You are created a new excel function called ntow

How to use the function Number to word

In excel 2007 you need to enable macros before typing function. As you have saved the work book macro enabled, you can see a warning message  just under the  menu tab like this .
Click on options, a new window appear,click on enable this content.you are done.
Now you have  Rs 1555 in cell A1 and you need the number in words cell A2 type in cell A2  =ntow(a2)
Press enter, the amount in words will have displayed.
If you dont want the rupees element, remove the following code from the script
If Val(Left(FIGURE, 9)) > 1 Then
Ntow = “Rupees ”
ElseIf Val(Left(FIGURE, 9)) = 1 Then
Ntow = “Rupee ”
End If
You can also use this function as
=ntow(1500 ) the number will be converted in to words in the same cell.




"""COPY THESE FUNCTION"""


Function Ntow(amt As Variant) As Variant
Dim FIGURE As Variant
Dim LENFIG As Integer
Dim i As Integer
Dim WORDs(19) As String
Dim tens(9) As String
WORDs(1) = "One"
WORDs(2) = "Two"
WORDs(3) = "Three"
WORDs(4) = "Four"
WORDs(5) = "Five"
WORDs(6) = "Six"
WORDs(7) = "Seven"
WORDs(8) = "Eight"
WORDs(9) = "Nine"
WORDs(10) = "Ten"
WORDs(11) = "Eleven"
WORDs(12) = "Twelve"
WORDs(13) = "Thirteen"
WORDs(14) = "Fourteen"
WORDs(15) = "Fifteen"
WORDs(16) = "Sixteen"
WORDs(17) = "Seventeen"
WORDs(18) = "Eighteen"
WORDs(19) = "Nineteen"

tens(2) = "Twenty"
tens(3) = "Thirty"
tens(4) = "Fourty"
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
Ntow = "Rupees "
ElseIf Val(Left(FIGURE, 9)) = 1 Then
Ntow = "Rupee "
End If

For i = 1 To 3
If Val(Left(FIGURE, 2)) < 20 And Val(Left(FIGURE, 2)) > 0 Then
Ntow = Ntow & WORDs(Val(Left(FIGURE, 2)))
ElseIf Val(Left(FIGURE, 2)) > 19 Then
Ntow = Ntow & tens(Val(Left(FIGURE, 1)))
Ntow = Ntow & WORDs(Val(Right(Left(FIGURE, 2), 1)))
End If

If i = 1 And Val(Left(FIGURE, 2)) > 0 Then
Ntow = Ntow & " Crore "
ElseIf i = 2 And Val(Left(FIGURE, 2)) > 0 Then
Ntow = Ntow & " Lakh "
ElseIf i = 3 And Val(Left(FIGURE, 2)) > 0 Then
Ntow = Ntow & " Thousand "
End If
FIGURE = Mid(FIGURE, 3)
Next i

If Val(Left(FIGURE, 1)) > 0 Then
Ntow = Ntow & WORDs(Val(Left(FIGURE, 1))) + " Hundred "
End If

FIGURE = Mid(FIGURE, 2)

If Val(Left(FIGURE, 2)) < 20 And Val(Left(FIGURE, 2)) > 0 Then
Ntow = Ntow & WORDs(Val(Left(FIGURE, 2)))
ElseIf Val(Left(FIGURE, 2)) > 19 Then
Ntow = Ntow & tens(Val(Left(FIGURE, 1)))
Ntow = Ntow & WORDs(Val(Right(Left(FIGURE, 2), 1)))
End If
FIGURE = Mid(FIGURE, 4)

If Val(FIGURE) > 0 Then
Ntow = Ntow & " Paise "
If Val(Left(FIGURE, 2)) < 20 And Val(Left(FIGURE, 2)) > 0 Then
Ntow = Ntow & WORDs(Val(Left(FIGURE, 2)))
ElseIf Val(Left(FIGURE, 2)) > 19 Then
Ntow = Ntow & tens(Val(Left(FIGURE, 1)))
Ntow = Ntow & WORDs(Val(Right(Left(FIGURE, 2), 1)))
End If
End If
FIGURE = amt
FIGURE = Format(FIGURE, "FIXED")
If Val(FIGURE) > 0 Then
Ntow = Ntow & " Only "
End If
End Function


Click Here to Download:

1 comment:

  1. Try...
    Free Excel Add-in Convert Excel cell Numbers to Words with Prefix and Suffix features.
    Download Link - http://www.xltool.in

    ReplyDelete

Headline Animator

Parmod Kumar Gupta

Subscribe via email

Enter your email address:

SAKSHI

You Might Also Like

Related Posts with Thumbnails