メインコンテンツへスキップ

Excelでインドルピーの数字を単語に変換する方法は?

この記事では、数値のリストをインドルピーの単語またはExcelの米ドルに変換する方法を紹介します。

VBAコードを使用して数値をインドルピーの単語に変換する

驚くべき機能で数字を米ドルの単語に変換する


VBAコードを使用して数値をインドルピーの単語に変換する

次のVBAコードは、数値をルピー単位の単語に変換するのに役立ちます。次のようにしてください。

1。 を押し続けます Alt + F11 キーを押して アプリケーション向け Microsoft Visual Basic 窓。

2に設定します。 OK をクリックします。 インセット > モジュール、モジュールウィンドウに次のコードを貼り付けます。

VBAコード:数値をルピーの単語に変換する

Public Function RupeeFormat(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
  RupeeFormat = ""
  Exit Function
End If
xNumStr = Trim(str(SNum))
If xNumStr = "" Then
  RupeeFormat = ""
  Exit Function
End If

xRStr = ""
xLp = 0
If (xNumStr > 999999999.99) Then
    RupeeFormat = "Digit excced Maximum limit"
    Exit Function
End If
xDPInt = InStr(xNumStr, ".")
If xDPInt > 0 Then
    If (Len(xNumStr) - xDPInt) = 1 Then
       xRStr_Paisas = RupeeFormat_GetT(Left(Mid(xNumStr, xDPInt + 1) & "0", 2))
    ElseIf (Len(xNumStr) - xDPInt) > 1 Then
       xRStr_Paisas = RupeeFormat_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 = RupeeFormat_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 = RupeeFormat_GetT(Right(xTemp, 2))
        ElseIf Val(xTemp) < 10 Then
            xStrTemp = RupeeFormat_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
    RupeeFormat = xRStr & xRStr_Paisas & " Only"
    End Function
Function RupeeFormat_GetH(xStrH As String, xLp As Integer)
Dim xRStr As String
If Val(xStrH) < 1 Then
    RupeeFormat_GetH = ""
    Exit Function
Else
   xStrH = Right("000" & xStrH, 3)
   If Mid(xStrH, 1, 1) <> "0" Then
        If (xLp > 0) Then
         xRStr = RupeeFormat_GetD(Mid(xStrH, 1, 1)) & " Lac "
        Else
         xRStr = RupeeFormat_GetD(Mid(xStrH, 1, 1)) & " Hundred "
        End If
    End If
    If Mid(xStrH, 2, 1) <> "0" Then
        xRStr = xRStr & RupeeFormat_GetT(Mid(xStrH, 2))
    Else
        xRStr = xRStr & RupeeFormat_GetD(Mid(xStrH, 3))
    End If
End If
    RupeeFormat_GetH = xRStr
End Function
Function RupeeFormat_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 & RupeeFormat_GetD(Right(xTStr, 1))
    End If
      RupeeFormat_GetT = xRStr
End Function
Function RupeeFormat_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
        RupeeFormat_GetD = xArr_1(Val(xDStr) - 1)
    Else
        RupeeFormat_GetD = ""
    End If
End Function 

3。 コードを挿入したら、コードウィンドウを保存して閉じ、ワークシートに戻って次の数式を入力します。 = RupeeFormat(A2) 空白のセルに入力し、塗りつぶしハンドルを下にドラッグして、この数式を他のセルに適用します。すべての数値はルピーで綴られています。スクリーンショットを参照してください。


驚くべき機能で数字を米ドルの単語に変換する

数字を英語の単語に変換したい場合は、 Kutools for Excelさん 数字から言葉へ 機能は、このジョブをすばやく簡単に解決するのに役立ちます。

ヒント:これを適用する 言葉への数 機能、まず、ダウンロードする必要があります Kutools for Excel、次に機能をすばやく簡単に適用します。

インストールした後 Kutools for Excel、次のようにしてください。

1。 変換する数値のリストを選択し、をクリックします クツール > コンテンツ > 数字から言葉へ、スクリーンショットを参照してください:

2。 の中に 数字から通貨の単語 ダイアログボックスで 英語 オプションから ESL, ビジネスESL <br> 中国語/フランス語、その他 セクションをクリックし、をクリックします Ok ボタンをクリックすると、選択した数字が英語の通貨の単語に変換されます。スクリーンショットを参照してください。

クリックしてKutoolsfor Excelと無料トライアルを今すぐダウンロードしてください!

 


  • スーパーフォーミュラバー (複数行のテキストと数式を簡単に編集できます); 読書レイアウト (多数のセルを簡単に読み取って編集する); フィルター範囲に貼り付け...
  • セル/行/列をマージする およびデータの保持。 分割セルコンテンツ; 重複する行と合計/平均を組み合わせる...重複セルを防止します。 範囲を比較する...
  • [複製]または[一意]を選択します 行; 空白行を選択 (すべてのセルは空です); スーパーファインドとファジーファインド 多くのワークブックで; ランダム選択...
  • 正確なコピー 数式参照を変更せずに複数のセル。 参照の自動作成 複数のシートに; 箇条書きを挿入、チェックボックスなど...
  • お気に入りの数式をすばやく挿入する、範囲、チャート、写真; セルを暗号化する パスワード付き。 メーリングリストを作成する そしてメールを送る...
  • テキストを抽出、テキストの追加、位置による削除、 スペースを削除する; ページング小計の作成と印刷。 セルの内容とコメントを変換する...
  • スーパーフィルター (フィルタースキームを保存して他のシートに適用します); 高度な並べ替え 月/週/日、頻度など。 特殊フィルター 太字、斜体...
  • ワークブックとワークシートを組み合わせる; キー列に基づいてテーブルをマージします。 データを複数のシートに分割; xls、xlsx、PDFをバッチ変換...
  • ピボットテーブルのグループ化 週番号、曜日など... ロック解除された、ロックされたセルを表示する さまざまな色で; 式/名前を持つセルを強調表示する...
kteタブ201905
  • Word、Excel、PowerPointでタブ付きの編集と読み取りを有効にする、パブリッシャー、アクセス、Visioおよびプロジェクト。
  • 新しいウィンドウではなく、同じウィンドウの新しいタブで複数のドキュメントを開いて作成します。
  • 生産性を 50% 向上させ、毎日何百回もマウス クリックを減らすことができます!
officetab下部

 

Comments (28)
No ratings yet. Be the first to rate!
This comment was minimized by the moderator on the site
Hi
How to eliminate paisa from the code
This comment was minimized by the moderator on the site
thanks alot
This comment was minimized by the moderator on the site
Hi,

Whenever I am saving this file, its showing below message.

Be Careful! Parts of your document may include personal information that can't be removed by the Document Inspector.

Pls suggest if this is safe and if yes, how can we remove this message window permanently.
This comment was minimized by the moderator on the site
Your code is probably the best one I have found so far on the internet. It is really nice and useful. I request to include a small facility if possible. Can you please modify the code, so that "and" will be displayed before the last denomination. For example, the amount 22,44,556 will be converted to "Rupees Twenty Two Lacs Forty Four Thousand Five Hundred Fifty Six Only". It will be best, if it can be converted as "Rupees Twenty Two Lacs Forty Four Thousand Five Hundred and Fifty Six Only". Kindly consider my request.
This comment was minimized by the moderator on the site
The VBA code works effectively. Thanks for sharing these simple and easy to follow tips & steps.
This comment was minimized by the moderator on the site
Can u pls share the code that would spell number for 9000 crore
This comment was minimized by the moderator on the site
Hey, Great Help! Thanks for creating such a wonderful code.

It has saved a lot of time. "God Bless You!!"
This comment was minimized by the moderator on the site
Tried multiple times it's not working. Please help
This comment was minimized by the moderator on the site
Hi Sir, Is it possible to set this for by default for every excel working sheet or not ?
This comment was minimized by the moderator on the site
Hello, Mukesh

Yes, as long as the code is copied into the vba window module, the formula can be applied to the whole workbook.
But when closing the workbook, you should save it as Excel Macro-Enabled Workbook file format.
Please have a try, thank you!
This comment was minimized by the moderator on the site
Thanks a lot it is very Helpful
There are no comments posted here yet
Load More
Please leave your comments in English
Posting as Guest
×
Rate this post:
0   Characters
Suggested Locations