Whole Number and Decimals

C

Charles Knight

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
 
B

bigwheel

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.
 
D

driller

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
 
Top