+ Reply to Thread
Results 1 to 13 of 13

Thousand Seperator (Not an excel built-in format) - a Real Comma & Spaces between numbers

  1. #1
    Registered User
    Join Date
    12-04-2014
    Location
    Chennai
    MS-Off Ver
    2013
    Posts
    19

    Post Thousand Seperator (Not an excel built-in format) - a Real Comma & Spaces between numbers

    I have a specific requirement, i can't use the built-in format in excel (when i press F2 key, format would not be there), So i need the same format (Spaces & Comma) to be persists when i edit the cell.

    Input: 456456456456.00

    I need the Output with 2 spaces inbetween each three numbers set (Billions, Millions, Thousands, Hundreds) : 456 , 456 , 456 , 456.00

    Output Format: 456<2Spaces>,<2Spaces>456<2Spaces>,<2Spaces>456.00
    Last edited by Sivashanmugam; 04-10-2015 at 09:41 AM.

  2. #2
    Forum Contributor LokeshKumar's Avatar
    Join Date
    03-31-2015
    Location
    India
    MS-Off Ver
    All, mostly 2010 now..
    Posts
    471

    Re: Thousand Seperator (Not an excel built-in format) - a Real Comma & Spaces between numb

    Hi,

    You are applying wrong approach, what is right approach just use replace command and replace , to space space , space space.
    Cheers.......
    Lokesh Kumar
    Stay Hungry.. Stay Foolish..
    _________________________________________________________
    Please Click STAR to Add Reputation if my/someone's answer helped!

  3. #3
    Registered User
    Join Date
    12-04-2014
    Location
    Chennai
    MS-Off Ver
    2013
    Posts
    19

    Re: Thousand Seperator (Not an excel built-in format) - a Real Comma & Spaces between numb

    Hi Lokesh, Thanks for your immediate Reply, I appreciate it. i made a mistake in the posting, Input doesn't have commas. Mentioned below is my requirement.

    Input 456456456456.00
    Output 456 , 456 , 456 , 456.00


    Thanks a lot in advance

  4. #4
    Forum Contributor LokeshKumar's Avatar
    Join Date
    03-31-2015
    Location
    India
    MS-Off Ver
    All, mostly 2010 now..
    Posts
    471

    Re: Thousand Seperator (Not an excel built-in format) - a Real Comma & Spaces between numb

    Hi,

    The formula will not work correctly always since there is decimal values.... but you can follow this trick to get over this problem..

    1. Change the custom format of all your data into this 000,000,000,000.00 (press Ctr+1 then go to numbers tab then custom).
    2. Once you do that then copy all the data into a notepad (you can see when you copy the data there is comma , after 3 digit).
    3. Now create new workbook and press Ctr A and again change the format of all cells into "Text".
    4. Now you can paste the data and use the replace command.
    5. When you got the appropriate result you can convert data back to number format.

    Cheers.....

  5. #5
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,436

    Re: Thousand Seperator (Not an excel built-in format) - a Real Comma & Spaces between numb

    select range to alter and then execute from immediate window.

    Please Login or Register  to view this content.
    Cheers
    Andy
    www.andypope.info

  6. #6
    Registered User
    Join Date
    12-04-2014
    Location
    Chennai
    MS-Off Ver
    2013
    Posts
    19

    Re: Thousand Seperator (Not an excel built-in format) - a Real Comma & Spaces between numb

    Lokesh, Your solutions works but since i'm going to do this for huge number of records, I'm suspecting, copying & pasting to other application & may match with other record which is irrelevant. if any solution within excel helps much.

  7. #7
    Registered User
    Join Date
    12-04-2014
    Location
    Chennai
    MS-Off Ver
    2013
    Posts
    19

    Re: Thousand Seperator (Not an excel built-in format) - a Real Comma & Spaces between numb

    Andy, Thanks for your reply, I couldn't understand could you help me to figure out how to implement your solution. Probably in sample attachment as an example would help. Thanks.

  8. #8
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,436

    Re: Thousand Seperator (Not an excel built-in format) - a Real Comma & Spaces between numb

    i converted the immediate window code to a macro
    Attached Files Attached Files

  9. #9
    Registered User
    Join Date
    12-04-2014
    Location
    Chennai
    MS-Off Ver
    2013
    Posts
    19

    Re: Thousand Seperator (Not an excel built-in format) - a Real Comma & Spaces between numb

    Thanks andy for providing it in a Macro enabled excel format. Macro works for me but my values may differ & dont have Standard No. of digits. it may vary like mentioned below,

    456,456,456,456.00
    456,456,456.00
    56,456,456.00
    56,456.00
    456,456.00
    456,456,456.00
    56,456,456,456.00
    6,456,456,456.00
    6,456,456.00
    6,456.00

    This case, your macro puts zeros in front of the value (in the prefix). Sorry i didn't mention this clearly in my requirement.

  10. #10
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,436

    Re: Thousand Seperator (Not an excel built-in format) - a Real Comma & Spaces between numb

    change the number format and do replace

    Please Login or Register  to view this content.

  11. #11
    Registered User
    Join Date
    12-04-2014
    Location
    Chennai
    MS-Off Ver
    2013
    Posts
    19

    Re: Thousand Seperator (Not an excel built-in format) - a Real Comma & Spaces between numb

    Thank you very much Andy, This code works for me. I just mentioned the range. it provides the output for 55000 cells within a minute.

    You made it. thanks a lot.

  12. #12
    Registered User
    Join Date
    12-04-2014
    Location
    Chennai
    MS-Off Ver
    2013
    Posts
    19

    Re: Thousand Seperator (Not an excel built-in format) - a Real Comma & Spaces between numb

    I have a bug on this code... Decimals are not getting retained wherever there is a zero.

    In the number formatting, two decimals are there but after we running this macro.. I'm only
    getting the output as 860.8, 928.3.. zeros are not getting retained... Please help me out on this.

    Output
    -------
    860.80
    928.30
    Attached Files Attached Files

  13. #13
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,436

    Re: Thousand Seperator (Not an excel built-in format) - a Real Comma & Spaces between numb

    Not a bug just a different requirement.

    Excel does not store the trailing zero in numbers. You would need to change the numberformat used in order to diisplay it.

    Please Login or Register  to view this content.

+ 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. Vlookup all matches in one cell with comma as seperator
    By Eijaz in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 11-25-2014, 04:13 AM
  2. [SOLVED] VBA code - Text to rows with comma seperator
    By shreeja178 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 08-27-2014, 07:21 AM
  3. [SOLVED] Getting info from Excel to be comma delimited with no spaces
    By himay in forum Excel General
    Replies: 3
    Last Post: 07-10-2014, 11:18 PM
  4. Replies: 6
    Last Post: 12-17-2011, 04:58 AM
  5. Replies: 1
    Last Post: 05-18-2006, 11:45 PM

Tags for this Thread

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