+ Reply to Thread
Results 1 to 8 of 8

Want to display numbers in Indian Currency format

  1. #1
    Registered User
    Join Date
    01-09-2016
    Location
    Delhi
    MS-Off Ver
    2007
    Posts
    6

    Want to display numbers in Indian Currency format

    A1 = 18,56,57,576.00
    A2= 18,39,01,547.00

    A3=(+)1756029

    In cell A3,formula applied is
    Please Login or Register  to view this content.
    IN cell A1 and A2, I displayed the numbers in Indian currency format using the Visual Basic Macros
    Please Login or Register  to view this content.
    In cell A3, I also want to run this Macro, but Error is coming because it contains(-) or (+) before it.

    How to do that , I want cell A3 contains(-) OR (+) and also displayed numbers in Indian Currency after Subtraction of A1-A2.

    Help me!!!

  2. #2
    Forum Expert
    Join Date
    06-08-2012
    Location
    Left the forum!
    MS-Off Ver
    Left the forum!
    Posts
    5,189

    Re: Want to display numbers in Indian Currency format

    You can't apply a number format to text, which is what your formula is producing.

    Change the formula to =A1-A2

    And try this code

    Please Login or Register  to view this content.
    Last edited by jason.b75; 01-09-2016 at 11:35 AM. Reason: revised code

  3. #3
    Registered User
    Join Date
    01-09-2016
    Location
    Delhi
    MS-Off Ver
    2007
    Posts
    6

    Re: Want to display numbers in Indian Currency format

    Thanks jason for reply....but using your Macros IndianNumberFormat-->My number A1 = 18,56,57,576.00 is displayed as simply 185657576.00

  4. #4
    Forum Expert
    Join Date
    06-08-2012
    Location
    Left the forum!
    MS-Off Ver
    Left the forum!
    Posts
    5,189

    Re: Want to display numbers in Indian Currency format

    Is A1 a number or the result of a formula?

    It works fine for me with 185657576.00 entered as a number.

    If it is a formula then it should still show with the (+) / (-) prefix, so I'm guessing that your numbers are actually text.

    See if this fixes it, if not then you will need to attach your workbook so I can see where it is going wrong.

    Please Login or Register  to view this content.
    Last edited by jason.b75; 01-10-2016 at 09:48 AM.

  5. #5
    Valued Forum Contributor
    Join Date
    12-28-2014
    Location
    NSW, Australia
    MS-Off Ver
    MS365
    Posts
    604

    Re: Want to display numbers in Indian Currency format

    I think sarvagya is happy with the way his macro works for formatting the numbers in A1 and A2. It's just A3 that he wants different. He wants (+)/(-) in front of the existing format from the macro...but only for that cell.

    If there is something that "marks" those cells...like borderlines or a cell beside it like "Balance" or something that can be checked to find the cells that you want the different format applied to, then maybe you could use that as a condition to add the (+)/(-) into your existing macro. Maybe make the text a slightly different colour and the macro could detect that and apply the different format.

    Sorry if I misunderstood or overstepped

  6. #6
    Forum Expert
    Join Date
    06-08-2012
    Location
    Left the forum!
    MS-Off Ver
    Left the forum!
    Posts
    5,189

    Re: Want to display numbers in Indian Currency format

    I think you're on the right track beamer, from the original post, I read it as the cell where (+)/(-) is required contains a formula, where the others contain numbers.

    I did originally post a slight edit (as below) to sarvagya's code, but the urge to shrink it got the better of me

    Please Login or Register  to view this content.
    This still needs the formula in A3 to be changed to =A1-A2

    Another method would be to stick with the original code, and use this formula in A3

    =IF(A1<A2,"(-)","(+)")&TEXT(ABS(A1-A2),REPT("##\,",MAX((LEN(ABS(A1-A2))-3)/2,0)+0.5)&"##0.00")

    But if the code that I provided isn't working then it implies that the source data is in a non-numeric format rather than the code is broken, so based on that theory, the original code shouldn't work either.

  7. #7
    Registered User
    Join Date
    01-09-2016
    Location
    Delhi
    MS-Off Ver
    2007
    Posts
    6

    Re: Want to display numbers in Indian Currency format

    Please Login or Register  to view this content.

    This code is abosolutely working......
    Thanks Very much again...

    I just want to ask one simple question regarding macros...Suppose i apply the macros on the cells and run it....Now I closed the file and do not save the macro...I just want to ask, when I open the file next time..on that cells, macros code will be applied or not??

  8. #8
    Forum Expert
    Join Date
    06-08-2012
    Location
    Left the forum!
    MS-Off Ver
    Left the forum!
    Posts
    5,189

    Re: Want to display numbers in Indian Currency format

    You don't save the macro, you save the workbook, which will save any changes made by the macro.

    If you close without saving then any changes made, by you, or by the macro since the last save will be discarded.

    If you save as a macro free workbook (.xlsx) then any changes made by the macro up to that point will be saved.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Replies: 8
    Last Post: 01-17-2024, 11:32 AM
  2. Replies: 8
    Last Post: 03-08-2012, 02:17 PM
  3. Customising the TEXT(Value,"Format") Function for Indian Currency
    By e4excel in forum Excel Formulas & Functions
    Replies: 11
    Last Post: 03-11-2011, 10:43 AM
  4. Spell number in indian currency
    By vsts2007 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-01-2010, 04:03 AM
  5. Replies: 2
    Last Post: 01-21-2006, 04:28 AM
  6. [SOLVED] Comma separator for custom Currency (Indian Rupee)
    By Bald Eagle in forum Excel General
    Replies: 1
    Last Post: 01-15-2006, 02:50 PM
  7. [SOLVED] custom currency format for Indian rupees
    By seenu in forum Excel General
    Replies: 1
    Last Post: 04-29-2005, 09:06 AM
  8. Currency and Numbers display
    By Billy Parkinson in forum Excel General
    Replies: 0
    Last Post: 01-11-2005, 09:06 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1