VBA & Macro Problems

Convert Numbers to Rupees and Paise in Excel

Steven ParkerSteven Parker Nov 22, 2026 872 views

Question details

Convert numeric amounts into English words using Indian rupees and paise.

Convert Numbers to Rupees and Paise in Excel
Product
Microsoft Excel
Device & OS
not provided
Scenario
The user wants amounts such as 1000 and 5000.25 written out as Indian currency.
Observed behavior
The desired results are “one thousand rupees” and “five thousand rupees and twenty-five paise,” with lakh and crore used for larger amounts.
Before you start

Open the workbook in a desktop version of Excel that supports VBA. Check that the source cells contain numeric amounts rather than text with currency symbols.

Solution 1Recommended

Create an Indian currency number-to-words VBA function

Use a custom worksheet function to spell nonnegative amounts in rupees and paise, including lakh and crore.

Excel does not have a built-in worksheet function that spells numbers as currency. This function rounds to the nearest paise and supports amounts below 100 crore after rounding.

1
Open the VBA editor

In desktop Excel, open the workbook and select Developer > Visual Basic. On Windows, you can also press Alt+F11.

2
Insert a module and add the code

In the VBA editor, select Insert > Module, then paste this code into the module: Public Function INRWords(ByVal amount As Variant) As Variant Dim totalPaise As Double, rupees As Long, paise As Long Dim n As Long, result As String On Error GoTo InvalidAmount If IsError(amount) Then GoTo InvalidAmount If Not IsNumeric(amount) Then GoTo InvalidAmount If CDbl(amount) < 0 Then INRWords = CVErr(xlErrNum) Exit Function End If totalPaise = Application.WorksheetFunction.Round(CDbl(amount) * 100, 0) If totalPaise >= 100000000000# Then INRWords = CVErr(xlErrNum) Exit Function End If rupees = CLng(Int(totalPaise / 100)) paise = CLng(totalPaise - CDbl(rupees) * 100) n = rupees If n >= 10000000 Then result = result & INRGroup(n \ 10000000) & " crore " n = n Mod 10000000 End If If n >= 100000 Then result = result & INRGroup(n \ 100000) & " lakh " n = n Mod 100000 End If If n >= 1000 Then result = result & INRGroup(n \ 1000) & " thousand " n = n Mod 1000 End If If n > 0 Then result = result & INRGroup(n) & " " If rupees = 0 Then result = "zero " result = Trim$(result) & " rupees" If paise > 0 Then result = result & " and " & INRGroup(paise) & " paise" INRWords = result Exit Function InvalidAmount: INRWords = CVErr(xlErrValue) End Function Private Function INRGroup(ByVal n As Long) As String Dim ones As Variant, tens As Variant, result As String ones = Split("zero one two three four five six seven eight nine ten eleven twelve thirteen fourteen fifteen sixteen seventeen eighteen nineteen", " ") tens = Split("zero ten twenty thirty forty fifty sixty seventy eighty ninety", " ") If n >= 100 Then result = ones(n \ 100) & " hundred" n = n Mod 100 If n > 0 Then result = result & " " End If If n >= 20 Then result = result & tens(n \ 10) If n Mod 10 > 0 Then result = result & "-" & ones(n Mod 10) ElseIf n > 0 Then result = result & ones(n) End If INRGroup = result End Function

3
Save as a macro-enabled workbook

Return to Excel and select File > Save As. Choose Excel Macro-Enabled Workbook (*.xlsm), and enable macros if Excel prompts you when you reopen the trusted file.

4
Convert and test amounts

Enter a number in A1 and type =INRWords(A1) in another cell. Test 1000, 5000.25, and 100000; they should produce “one thousand rupees,” “five thousand rupees and twenty-five paise,” and “one lakh rupees.”

Range and rounding: The function returns an error for negative values or amounts that round to 100 crore or more. It omits paise when the rounded paise amount is zero.
Free Microsoft Office alternative

Work with currency spreadsheets in WPS Office

WPS Office is a free, lightweight alternative with a familiar spreadsheet interface and Microsoft Excel format compatibility, making it easy to move everyday workbook tasks between suites. The Excel VBA function above requires a compatible VBA environment and is not a guaranteed fix in WPS Office.

Work with numeric currency amounts in WPS SpreadsheetsOpen and edit Microsoft Excel XLSX filesUse a familiar spreadsheet interface for everyday workMove common spreadsheet tasks to a free, lightweight office suite
microsoft office alternative - wps office

Frequently Asked Questions

Can an Excel formula spell rupees without a macro?

Excel has no built-in number-to-words worksheet function. You can add the VBA function in Insert > Module and then call it with =INRWords(A1).

Does changing dollars to rupees in a macro add lakh and crore?

No. Changing the currency labels alone does not change how numbers are grouped. Use a function designed for the Indian lakh and crore system and test it with amounts such as 100000 and 10000000.

How does the function handle amounts with more than two decimal places?

It rounds the amount to the nearest paise before converting it. For example, enter 5000.256 in A1 and use =INRWords(A1) to get “five thousand rupees and twenty-six paise.”

Why does my workbook need the XLSM format?

The custom function is VBA code. Select File > Save As and choose Excel Macro-Enabled Workbook (*.xlsm) to retain it; enable macros only when you trust the workbook.

Can I run this VBA function in Excel for the web?

Excel for the web cannot run VBA macros. Open the workbook in a desktop version of Excel that supports VBA to use the function.