A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » General Discussion
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Controlling decimal digits



 
 
Thread Tools Display Modes
  #1  
Old March 1st, 2010, 06:48 AM posted to microsoft.public.access
John
external usenet poster
 
Posts: 308
Default Controlling decimal digits

Hi

I have a few numeric hours appear on a report like this;

2
9.75
12.5

This is all fine but when a number like 1.83333 appears I only would like it
to limit to two decimal places as 1.83. How can I achieve this?

Thanks

Regards



  #2  
Old March 1st, 2010, 07:06 AM posted to microsoft.public.access
John W. Vinson
external usenet poster
 
Posts: 18,261
Default Controlling decimal digits

On Mon, 1 Mar 2010 06:48:35 -0000, "John" wrote:

Hi

I have a few numeric hours appear on a report like this;

2
9.75
12.5

This is all fine but when a number like 1.83333 appears I only would like it
to limit to two decimal places as 1.83. How can I achieve this?

Thanks

Regards


Set the Format to #.00; or use the Round() function if you're calculating the
value to round it to two decimals.
--

John W. Vinson [MVP]
  #3  
Old March 1st, 2010, 07:13 AM posted to microsoft.public.access
John
external usenet poster
 
Posts: 308
Default Controlling decimal digits

Hi John

Thanks. Using #.00 works for 1.83333 to make it 1.83 but for other numbers
2, 9.75, 12.5 it also changes them to 2.00, 12.50. How can I get round that?

Basically the values are hours and it looks good if no zeros show after
decimal if its a complete number.

Thanks

"John W. Vinson" wrote in message
...
On Mon, 1 Mar 2010 06:48:35 -0000, "John"
wrote:

Hi

I have a few numeric hours appear on a report like this;

2
9.75
12.5

This is all fine but when a number like 1.83333 appears I only would like
it
to limit to two decimal places as 1.83. How can I achieve this?

Thanks

Regards


Set the Format to #.00; or use the Round() function if you're calculating
the
value to round it to two decimals.
--

John W. Vinson [MVP]



  #4  
Old March 1st, 2010, 07:19 AM posted to microsoft.public.access
John
external usenet poster
 
Posts: 308
Default Controlling decimal digits

Basically I need formatting applied as below;

Before / After
2 / 2
9.75 / 9.75
12.5 / 12.5
1.83333 / 1.83

Basically if digits after decimal are more than two then round/trim to two
decimal., leave everything else alone.

Thanks

Regards

"John W. Vinson" wrote in message
...
On Mon, 1 Mar 2010 06:48:35 -0000, "John"
wrote:

Hi

I have a few numeric hours appear on a report like this;

2
9.75
12.5

This is all fine but when a number like 1.83333 appears I only would like
it
to limit to two decimal places as 1.83. How can I achieve this?

Thanks

Regards


Set the Format to #.00; or use the Round() function if you're calculating
the
value to round it to two decimals.
--

John W. Vinson [MVP]



  #5  
Old March 1st, 2010, 05:10 PM posted to microsoft.public.access
John W. Vinson
external usenet poster
 
Posts: 18,261
Default Controlling decimal digits

On Mon, 1 Mar 2010 07:19:54 -0000, "John" wrote:

Basically I need formatting applied as below;

Before / After
2 / 2
9.75 / 9.75
12.5 / 12.5
1.83333 / 1.83

Basically if digits after decimal are more than two then round/trim to two
decimal., leave everything else alone.


If just using Round() doesn't work, then I don't know any *simple* way to do
that. You would need some VBA code to parse the number and construct a text
string with the desired decimals.
--

John W. Vinson [MVP]
  #6  
Old March 13th, 2010, 05:59 PM posted to microsoft.public.access
De Jager
external usenet poster
 
Posts: 393
Default Controlling decimal digits


"John" wrote in message
...
Hi

I have a few numeric hours appear on a report like this;

2
9.75
12.5

This is all fine but when a number like 1.83333 appears I only would like
it to limit to two decimal places as 1.83. How can I achieve this?

Thanks

Regards




  #7  
Old March 17th, 2010, 01:34 PM posted to microsoft.public.access
joelgeraldine
external usenet poster
 
Posts: 201
Default Controlling decimal digits

p^




"John" a écrit dans le message de groupe de
discussion : ...
Hi

I have a few numeric hours appear on a report like this;

2
9.75
12.5

This is all fine but when a number like 1.83333 appears I only would like
it to limit to two decimal places as 1.83. How can I achieve this?

Thanks

Regards



 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 07:14 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.