Prev: Zoom box command
Next: SQL syntax help please
From: John on 1 Mar 2010 01:48 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
From: John W. Vinson on 1 Mar 2010 02:06 On Mon, 1 Mar 2010 06:48:35 -0000, "John" <info(a)nospam.infovis.co.uk> 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]
From: John on 1 Mar 2010 02:13 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" <jvinson(a)STOP_SPAM.WysardOfInfo.com> wrote in message news:1qpmo5hjko1d5kljv2610vl75f2kr7jm5m(a)4ax.com... > On Mon, 1 Mar 2010 06:48:35 -0000, "John" <info(a)nospam.infovis.co.uk> > 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]
From: John on 1 Mar 2010 02:19 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" <jvinson(a)STOP_SPAM.WysardOfInfo.com> wrote in message news:1qpmo5hjko1d5kljv2610vl75f2kr7jm5m(a)4ax.com... > On Mon, 1 Mar 2010 06:48:35 -0000, "John" <info(a)nospam.infovis.co.uk> > 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]
From: John W. Vinson on 1 Mar 2010 12:10
On Mon, 1 Mar 2010 07:19:54 -0000, "John" <info(a)nospam.infovis.co.uk> 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] |