Rounding numbers

  • Thread starter Thread starter Robin Linton
  • Start date Start date
R

Robin Linton

How can I round numbers to the nearest tenth. I have
several calculations in place and I have to round my
number to the nearest tenth at a certain point in the
calculation.

Example 131-60 =77
77 x .25 = 17.75
17.75 + 60 = 77.75
77.75 / 15 = 5.18 ( I need the 5.18 to round off to 5.2)
5.2 x 41
 
How can I round numbers to the nearest tenth. I have
several calculations in place and I have to round my
number to the nearest tenth at a certain point in the
calculation.

Example 131-60 =77
77 x .25 = 17.75
17.75 + 60 = 77.75
77.75 / 15 = 5.18 ( I need the 5.18 to round off to 5.2)
5.2 x 41

Use the Round() function:

Round(77.5 / 15, 1)
 
That worked great, but what if I don't know the value of
the number I want teo divide and round off. I'm updating
thousands of record at a time and the number will be
different in most cases. The field where the 77.75 goes
is called Anes/Ob Total. I tried Round(Anes/Ob
Total)/15,1 and I get a syntax error.
 
The field where the 77.75 goes
is called Anes/Ob Total. I tried Round(Anes/Ob
Total)/15,1 and I get a syntax error.

If you have blanks in the fieldname (or other special characters) you
must enclose the fieldname in square brackets; I do so routinely for
fields just to avoid confusion with strings and to make the code
easier to read. You also have a misplaced parenthesis. Try

Round(([Anes] / [Ob Total])/15, 1)
 
Thanks, I finally got it to work
-----Original Message-----
The field where the 77.75 goes
is called Anes/Ob Total. I tried Round(Anes/Ob
Total)/15,1 and I get a syntax error.

If you have blanks in the fieldname (or other special characters) you
must enclose the fieldname in square brackets; I do so routinely for
fields just to avoid confusion with strings and to make the code
easier to read. You also have a misplaced parenthesis. Try

Round(([Anes] / [Ob Total])/15, 1)




.
 
Back
Top