Number format

M

Mark Olsen

Could someone tell me if this is possible and how to do it if it is in using
the custom number formats in Excel. I want to have thousands separators in
my number. I know how to add this but my problem is that if there is no
decimal part of the number then I dont want the decimal point to appear. If
there is a decimal part then I want the decimal point involved. It would be
even better if I could have it do 2 digits of precision if there is a decimal
part but that is not totally necessary.

For Example

8300
8300.25
8300.20
754

Thanks,

Mark
 
T

Toppers

Mark,
This cannot be done with a single format. An example using a
formula is:

Number in A1, formula in B1

=IF(MOD(A1,1)=0,TEXT(A1,"#,###"),TEXT(A1,"#,###.00"))

You probably want the VBA equivalent which could be initiated with a
Worksheet event i.e entry in column A triggers code to set "numberformat" of
cell.

HTH
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top