Custom Number Format problem

R

RiTz21

I need a special number format, but I can't seem to get what I want:

IF a number is an integer, then there should be NO decimal point
displayed.
IF a number has a decimal part, then if should display only one digit
for it.

For instance:

3 -> 3
4.34 -> 4.3
2.88 -> 2.9
34 -> 34
5.01 -> 5.0

Is it possible to do this with a custom number format ?

THANKS !

R
P.S. I would prefer NOT to use any VBA to do this!
 
N

Niek Otten

Maybe.

But easier would be:

=IF(MOD(A1,1)=0,INT(A1),ROUND(A1,1))

and format as General

Of course you can replace A1 with your original formula, but then it is calculated twice

--
Kind regards,

Niek Otten
Microsoft MVP - Excel


|I need a special number format, but I can't seem to get what I want:
|
| IF a number is an integer, then there should be NO decimal point
| displayed.
| IF a number has a decimal part, then if should display only one digit
| for it.
|
| For instance:
|
| 3 -> 3
| 4.34 -> 4.3
| 2.88 -> 2.9
| 34 -> 34
| 5.01 -> 5.0
|
| Is it possible to do this with a custom number format ?
|
| THANKS !
|
| R
| P.S. I would prefer NOT to use any VBA to do this!
|
 
R

RiTz21

Alas, this is for a cell where the user 'inputs' numbers... so I cannot
have a formula in that cell!! I seek a way using the Custom Format, if
it is doable...

Thanks !
R
 

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