+ Reply to Thread
Results 1 to 5 of 5

Thousands Separator with optional decimal

  1. #1
    Registered User
    Join Date
    10-18-2007
    Posts
    4

    Thousands Separator with optional decimal

    I'd like to format a worksheet with all of the numbers having a thousands separator but only displaying a decimal point if it's needed. Can this be done?

  2. #2
    Forum Guru
    Join Date
    08-05-2004
    Location
    NJ
    MS-Off Ver
    365
    Posts
    13,582
    Yes, go to Format Cell, Custom and type in #,###.### (assuming a maximum of 3 digits, add more if you like). That should do it.

    ChemistB

  3. #3
    Registered User
    Join Date
    10-18-2007
    Posts
    4
    Sooooo close. That leaves me with a decimal point after every number, whether there's anything to put after it or not.

  4. #4
    Forum Guru
    Join Date
    08-05-2004
    Location
    NJ
    MS-Off Ver
    365
    Posts
    13,582
    Hmmm, don't think you can get rid of the decimal point.

    ChemistB

  5. #5
    Registered User
    Join Date
    02-09-2015
    Location
    England
    MS-Off Ver
    2010
    Posts
    1

    Re: Thousands Separator with optional decimal

    Initially fiddly but to get the exact desired result I would add another column next to the one you want to format, hide that real one and use a nested if statement instead..

    eg: if the number 1,000,000 was in B10 (and I hid the B column) I would put in C10 the below formula:-

    =(IF(B10>=1000,IF(B10>=1000000,"£"&ROUND(B10/1000000,2)&"M","£"&ROUND(B10/1000,2)&"k"),"£"&B10))

    it would produce
    1M

    if B10 was 1,115,000 it would produce
    1.12M
    if B10 was 1,115 it would produce
    1.12K
    if B10 was 15,500 it would produce
    15.5K

    Change the round number to the desired decimal, I chose two here, but as you see it goes to 1 or none if there are zero's there.

    You would have to add more nests for negative.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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