ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   cell that accepts a whole number or five place deciaml (https://www.excelbanter.com/excel-worksheet-functions/6217-cell-accepts-whole-number-five-place-deciaml.html)

crck_whr

cell that accepts a whole number or five place deciaml
 
Is there a way to format a cell so that if you enter a whole number it stays
the way it was entered byt if you enter a decimal it gives the number five
decimal places? I have tried using general cell formatiing but this drops
zeros from the end and I need them to be displayed.

Frank Kabel

Hi
AFAIK there's no such format. This would either require VBA (using an event
procedure) or a separate cell with a helper formula (which would be difficult
for trainling zeros though)

"crck_whr" wrote:

Is there a way to format a cell so that if you enter a whole number it stays
the way it was entered byt if you enter a decimal it gives the number five
decimal places? I have tried using general cell formatiing but this drops
zeros from the end and I need them to be displayed.


K.S.Warrier

Hi,
Suppose you have the number with decimals in cell A1.Then in B1 ,first
format the cell to 5 decimals & then,write
=if(mod(A1,1)=0,int(A1),A1) which will give you the desired result.This
may be repeated in other cells also.
Thank you,
K.S.Warrier

"crck_whr" wrote:

Is there a way to format a cell so that if you enter a whole number it stays
the way it was entered byt if you enter a decimal it gives the number five
decimal places? I have tried using general cell formatiing but this drops
zeros from the end and I need them to be displayed.



All times are GMT +1. The time now is 06:01 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com