Control decimals

G

Guest

Hi all,

In my case, if the number is large enough, I would like to decrease the
decimal places,
for example, 999.121 should be changed into 999.1, and if the number is
small for example 23.123, I would like to keep the decimal places
I display the numbers in textbox controls

Clara

thank you so much for your help
 
T

Tom Lake

clara said:
Hi all,

In my case, if the number is large enough, I would like to decrease the
decimal places,
for example, 999.121 should be changed into 999.1, and if the number is
small for example 23.123, I would like to keep the decimal places
I display the numbers in textbox controls


Left(Trim(Str([YourNumber])), 5)

will give you up to five characters but will truncate rather than round.

999.192 will be 999.1 after the transformation.

Tom Lake
 
O

onedaywhen

In my case, if the number is large enough, I would like to decrease thedecimalplaces,
for example, 999.121 should be changed into 999.1, and if the number is
small for example 23.123, I would like to keep thedecimalplaces
I display the numbers in textbox controls

I've no idea what "large enough" means to you, other than 23.123 is
not large enough and 999.121 is. Significant figures? Decimal portion?
Absolute value e.g. is minus 999.121 "large enough"?

A better spec please, preferably with many more examples! TIA.

Jamie.

--
 
G

Guest

Hi there,

if a number is >= 100, I would like to keep decimal places equal to 1 , for
example instead of displaying 105.156, 105.2 is preferred, and when a number
is < 100, I would like to keep decimal places to 3, for example 99.675

Clara
 

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