Thousands separator problem

davester

New Member
Joined
May 1, 2008
Messages
4
On my indows XP box, when I type a number into an Excel spreadsheet and it is in "General" format, the numbers appears like this (examples):

1234567

or this:

7.125

or this:

8.1

I want them to look just like that except for the first one, which I want to have the thousands separator:

1,234,567

I don't want to use a number format because
Excel makes you set a specific number of decimal places...I want the decimal places to float depending on how many decimal places there are in the entered number (just like the "General" format does). So basically, I want a "General" format, but with thousands separators (commas).

I tried using something like ###,###.### but that leaves a decimal place at the end of each integer (i.e. "123,456.") which is also not acceptable.

Does anybody know 1) what I am talking about, 2) how to fix it.

Thanks for any help.
 
Thanks Yogi, you're getting the result I want, but the method may be a bit too cumbersome. Plus, the spreadsheets will need to be manipulated by other users who will be mystified by that formula, and will wonder why I have a separate formatted worksheet for every input data worksheet.

This problem seems so elementary that I thought I was just missing some simple Excel formatting method...apparently not.
 
Upvote 0

Excel Facts

How to create a cell-sized chart?
Tiny charts, called Sparklines, were added to Excel 2010. Look for Sparklines on the Insert tab.
Thanks Yogi, you're getting the result I want, but the method may be a bit too cumbersome. Plus, the spreadsheets will need to be manipulated by other users who will be mystified by that formula, and will wonder why I have a separate formatted worksheet for every input data worksheet.

This problem seems so elementary that I thought I was just missing some simple Excel formatting method...apparently not.

Hi davester:

If you want to format the entries in place, then you may want to use the following macro code ...
Code:
For Each cell In Range("A2:A7")
    If Int(cell.Value) - cell.Value = 0 Then
        cell.NumberFormat = "###,###"
        Else
        cell.NumberFormat = "###,###.##"
    End If
Next cell

the preceding code is for formatting to your specification the entries in cells A2:A7 -- modify the range to suit.

I hope this helps.
 
Upvote 0

Forum statistics

Threads
1,216,526
Messages
6,131,187
Members
449,631
Latest member
mehboobahmad

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top