Whole Number and Decimals

G

Guest

Is there a way to limit the deicmal formatting to only non-whole numbers.
Example: 5 would show as 5 instead of 5.000 while 5.245 would still show
correctly.

The cell I am working with is a calcuted one (=sum(a1*b1)) so the number is
sometimes requires a decimal and sometimes not. Any help or suggestions would
be greatly appreciated.
 
T

T. Valko

Try this:

Format the cell as GENERAL

=IF(MOD(A1*B1,1),ROUND(A1*B1,3),A1*B1)

Biff
 
S

Sandy Mann

A cell format of General will give you that. General is the default format.

--
HTH

Sandy
In Perth, the ancient capital of Scotland
and the crowning place of kings

(e-mail address removed)
(e-mail address removed) with @tiscali.co.uk
 
G

Guest

This is the default for Excel. If you are getting something else try
formatting the cell to General. I can't quite figure out what purpose the
SUM funtion is doing in your example because =A1*B1 will give the same result.
 
G

Guest

Hi Charles Knight,

I have seen your reason that you need to display in the sum cell the actual
un-rounded value on the last decimal...the sheets standard column width
suppress the value...unless you double click the header's column right
edge...

Excluding the limited of number of digits....

I suggest that you format your sum cell in format>cells>number>custom
type #,###.###########
the bargain here is that if the sum result is a whole number,
e.g. "5" the displayed value will be "5."

i hope i made it clear only to help you.

regards,
driller
 

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