How to Display the Indian Rupee Symbol for Negative Excel Values in VBA
Question details
The user needs to display the Indian Rupee symbol (₹) for negative numbers when formatting values using Excel VBA.

- Product
- Microsoft Excel
- Device & OS
- not provided
- Scenario
- Applying custom number formats to Indian-numbering values via a VBA macro, specifically where negative values are enclosed in parentheses.
- Observed behavior
- The Indian Rupee symbol successfully appears for positive numbers but disappears when applied to negative values shown in parentheses.
Before editing your VBA macro, ensure you have basic familiarity with how custom number format strings are separated into distinct sections (Positive; Negative; Zero; Text).
Update the VBA Format String to Include the Symbol in Parentheses
Modify your existing VBA code to explicitly inject the Indian Rupee symbol into the negative-number section of the format string.
In Excel VBA, custom number formats handle different value types in separate sections. Modifying the format string for positive values does not automatically carry over the currency symbol to negative values.
To fix this, you must apply a replacement function that specifically targets the parenthesis structure of the negative number format and inserts the Rupee symbol inside it.
Open the VBA editor (ALT + F11) and find the line where you apply the number format to your cells. It often looks like: cell.NumberFormat = ChrW(8377) & vFmt(i)
Update the code line to use the Replace function, which will insert the Rupee symbol right after the opening parenthesis. Change it to: cell.NumberFormat = ChrW(8377) & Replace(vFmt(i), "(", "(" & ChrW(8377))
Save your code and run the macro again. Your negative values should now correctly display the Indian Rupee symbol inside the parentheses.

Use WPS Spreadsheet to Run and Debug VBA Macros Efficiently
WPS Office offers robust VBA support, allowing you to run, edit, and troubleshoot custom macros seamlessly, including those dealing with complex number formatting and regional currency symbols like the Indian Rupee.
- 1. Open your workbook in WPS Spreadsheet: Launch WPS Office and open your .xlsm file containing the formatting macro.
- 2. Access the VBA Editor: Navigate to the Developer tab on the ribbon and click on 'Visual Basic' to open the built-in code editor.
- 3. Update and run your code: Apply the ChrW(8377) replacement fix to your code and run the macro to instantly format your negative values.

Frequently Asked Questions
What is the correct VBA character code for the Indian Rupee symbol?
The Unicode character code for the Indian Rupee symbol (₹) is 8377. In VBA, you can easily insert this symbol into strings using the ChrW(8377) function.
Why do custom number formats in VBA affect positive and negative numbers differently?
Excel custom number formats contain up to four distinct sections separated by semicolons: Positive, Negative, Zero, and Text. Because they are handled independently, a currency symbol applied to the positive section does not automatically appear in the negative section.
Can I format negative numbers to display in red alongside the Rupee symbol?
Yes. You can add the [Red] condition to the negative section of your custom format string. When writing your VBA string concatenation, ensure the color tag is included within the block handling the negative format.




