Type Here to Get Search Results !

Bottom Ad

How To Convert Numbers To Words In Indian Rupees In Excel

 How To Convert Numbers To Words In Indian Rupees In Excel

Convert Numbers To Words In Indian Rupees With VBA Code

     Convert Numbers To Words In Indian Rupees In Excel, How to convert numbers to words in Indian rupees in Excel?, Convert numbers into words - Excel, SpellNumber Indian Rupees Function In Excel, 
Convert Currency in Number to Words (Indian Rupees), Convert number to words in Indian Rupees in Excel, Convert number to words in Indian rupees Online, Convert number to words in Excel, Spell number in Excel, Spell number in Excel download, How to convert numeric into words in Excel 2007,How to write Rupees in words


The following VBA code can help you to convert the numbers to words in Indian rupees.

Things to note

1. Press Your keyboard ALT + F11 keys to open the Microsoft Visual Basic for Applications window.

2. Click on top bar menu Insert > Module, and paste the following code in the Module Window.

3. Save excel file in Save as type- Excel Micro-Enabled Workbook

After pasting the code, save and close the code window, return to the worksheet and enter the following formula: = Inword (A1) in a blank cell, see screenshot 

VBA code: Convert numbers to words in Indian rupees format:-

[Public Function inword(SNum As String)
'Updateby Extendoffice
Dim xDPInt As Integer
Dim xArrPlace As Variant
Dim xRStr_Paisas As String
Dim xNumStr As String
Dim xF As Integer
Dim xTemp As String
Dim xStrTemp As String
Dim xRStr As String
Dim xLp As Integer
xArrPlace = Array("", "", " Thousand ", " Lacs ", " Crores ", " Trillion ", "", "", "", "")
On Error Resume Next
If SNum = "" Then
  inword = ""
  Exit Function
End If
xNumStr = Trim(str(SNum))
If xNumStr = "" Then
  inword = ""
  Exit Function
End If
 
xRStr = ""
xLp = 0
If (xNumStr > 999999999.99) Then
    inword = "Digit excced Maximum limit"
    Exit Function
End If
xDPInt = InStr(xNumStr, ".")
If xDPInt > 0 Then
    If (Len(xNumStr) - xDPInt) = 1 Then
       xRStr_Paisas = inword_GetT(Left(Mid(xNumStr, xDPInt + 1) & "0", 2))
    ElseIf (Len(xNumStr) - xDPInt) > 1 Then
       xRStr_Paisas = inword_GetT(Left(Mid(xNumStr, xDPInt + 1), 2))
    End If
        xNumStr = Trim(Left(xNumStr, xDPInt - 1))
    End If
    xF = 1
    Do While xNumStr <> ""
        If (xF >= 2) Then
            xTemp = Right(xNumStr, 2)
        Else
            If (Len(xNumStr) = 2) Then
                xTemp = Right(xNumStr, 2)
            ElseIf (Len(xNumStr) = 1) Then
                xTemp = Right(xNumStr, 1)
            Else
                xTemp = Right(xNumStr, 3)
            End If
        End If
        xStrTemp = ""
        If Val(xTemp) > 99 Then
            xStrTemp = inword_GetH(Right(xTemp, 3), xLp)
            If Right(Trim(xStrTemp), 3) <> "Lac" Then
            xLp = xLp + 1
            End If
        ElseIf Val(xTemp) <= 99 And Val(xTemp) > 9 Then
            xStrTemp = inword_GetT(Right(xTemp, 2))
        ElseIf Val(xTemp) < 10 Then
            xStrTemp = inword_GetD(Right(xTemp, 2))
        End If
        If xStrTemp <> "" Then
            xRStr = xStrTemp & xArrPlace(xF) & xRStr
        End If
        If xF = 2 Then
            If Len(xNumStr) = 1 Then
                xNumStr = ""
            Else
                xNumStr = Left(xNumStr, Len(xNumStr) - 2)
            End If
       ElseIf xF = 3 Then
            If Len(xNumStr) >= 3 Then
                 xNumStr = Left(xNumStr, Len(xNumStr) - 2)
            Else
                xNumStr = ""
            End If
        ElseIf xF = 4 Then
          xNumStr = ""
    Else
        If Len(xNumStr) <= 2 Then
        xNumStr = ""
    Else
        xNumStr = Left(xNumStr, Len(xNumStr) - 3)
        End If
    End If
        xF = xF + 1
Loop
    If xRStr = "" Then
       xRStr = "No Rupees"
    Else
       xRStr = " Rupees " & xRStr
    End If
    If xRStr_Paisas <> "" Then
       xRStr_Paisas = " and " & xRStr_Paisas & " Paisas"
    End If
    inword = xRStr & xRStr_Paisas & " Only"
    End Function
Function inword_GetH(xStrH As String, xLp As Integer)
Dim xRStr As String
If Val(xStrH) < 1 Then
    inword_GetH = ""
    Exit Function
Else
   xStrH = Right("000" & xStrH, 3)
   If Mid(xStrH, 1, 1) <> "0" Then
        If (xLp > 0) Then
         xRStr = inword_GetD(Mid(xStrH, 1, 1)) & " Lac "
        Else
         xRStr = inword_GetD(Mid(xStrH, 1, 1)) & " Hundred "
        End If
    End If
    If Mid(xStrH, 2, 1) <> "0" Then
        xRStr = xRStr & inword_GetT(Mid(xStrH, 2))
    Else
        xRStr = xRStr & inword_GetD(Mid(xStrH, 3))
    End If
End If
    inword_GetH = xRStr
End Function
Function inword_GetT(xTStr As String)
    Dim xTArr1 As Variant
    Dim xTArr2 As Variant
    Dim xRStr As String
    xTArr1 = Array("Ten", "Eleven", "Twelve", "Thirteen", "Fourteen", "Fifteen", "Sixteen", "Seventeen", "Eighteen", "Nineteen")
    xTArr2 = Array("", "Twenty", "Thirty", "Forty", "Fifty", "Sixty", "Seventy", "Eighty", "Ninety")
    Result = ""
    If Val(Left(xTStr, 1)) = 1 Then
        xRStr = xTArr1(Val(Mid(xTStr, 2, 1)))
    Else
        If Val(Left(xTStr, 1)) > 0 Then
            xRStr = xTArr2(Val(Left(xTStr, 1)) - 1)
        End If
        xRStr = xRStr & inword_GetD(Right(xTStr, 1))
    End If
      inword_GetT = xRStr
End Function
Function inword_GetD(xDStr As String)
Dim xArr_1() As Variant
    xArr_1 = Array(" One", " Two", " Three", " Four", " Five", " Six", " Seven", " Eight", " Nine", "")
    If Val(xDStr) > 0 Then
        inword_GetD = xArr_1(Val(xDStr) - 1)
    Else
        inword_GetD = ""
    End If
End Function]
Convert Numbers To Words In Indian Rupees In Excel, 
How to convert numbers to words in Indian rupees in Excel?
Convert numbers into words - Excel
SpellNumber Indian Rupees Function In Excel
Convert Currency in Number to Words (Indian Rupees)
Convert number to words in Indian Rupees in Excel
Convert number to words in Indian rupees Online
Convert number to words in Excel
Spell number in Excel
Spell number in Excel download
How to convert numeric into words in Excel 2007
How to write Rupees in words

Post a Comment

1 Comments
Unknown said…
VERY VERY HELPFUL. MANY MANY THANKS.

Top Post Ad

Bottom Post Ad

Bottom Ad