From: Abay on 7 Feb 2010 19:42 Hello, I am trying to round the results of a calculation without success. I would like the result of the following to round up to 2 decimal places. Dgst - dlinetot / 105 * 5 Dgst is defined as a number with 2 decimal places Dlinetot is defined as a number with 3 decimal places The result should be 4.67 but shows 4.66 I tried using the Round function (using the sytax from access help),as follows: round (dgst = dlinetot / 105 * 5 [,2]) or round (dgst=dlinetot/105 * 5, 2) and get an error msg "expected end of statement" I know I am doing something wrong .. so any help with this would be most appreciated. Abay
From: Stuart McCall on 7 Feb 2010 20:17 "Abay" <abcd(a)aol.com> wrote in message news:%23QAeMeFqKHA.4532(a)TK2MSFTNGP05.phx.gbl... > Hello, > > I am trying to round the results of a calculation without success. > > I would like the result of the following to round up to 2 decimal places. > > Dgst - dlinetot / 105 * 5 > > Dgst is defined as a number with 2 decimal places > Dlinetot is defined as a number with 3 decimal places > > The result should be 4.67 but shows 4.66 > > I tried using the Round function (using the sytax from access help),as > follows: > > round (dgst = dlinetot / 105 * 5 [,2]) or > round (dgst=dlinetot/105 * 5, 2) and get an error msg "expected end of > statement" > > I know I am doing something wrong .. so any help with this would be most > appreciated. > > Abay Your 2nd try with the round function almost had it. Try: dgst = round(dlinetot/105 * 5, 2) This assigns the result from the round function to dgst.
From: John W. Vinson on 7 Feb 2010 20:21 On Sun, 7 Feb 2010 16:42:21 -0800, "Abay" <abcd(a)aol.com> wrote: >Dgst - dlinetot / 105 * 5 > >Dgst is defined as a number with 2 decimal places >Dlinetot is defined as a number with 3 decimal places > >The result should be 4.67 but shows 4.66 4.66 is correct; Access uses "Banker's Rounding". A value ending in 5 will round to the nearest *even* number, up or down, rather than always rounding up; this gives a more accurate result, since the average of a large set of numbers will be closer to the average of the same set, rounded. The "rounding up" algorithm will make the results creep up. -- John W. Vinson [MVP]
From: Abay on 7 Feb 2010 21:15 Thank you John for the information .. good to know. Abay "John W. Vinson" <jvinson(a)STOP_SPAM.WysardOfInfo.com> wrote in message news:ikpum51kb7i2ve4av8k9q7h6nt89js50b5(a)4ax.com... > On Sun, 7 Feb 2010 16:42:21 -0800, "Abay" <abcd(a)aol.com> wrote: > >>Dgst - dlinetot / 105 * 5 >> >>Dgst is defined as a number with 2 decimal places >>Dlinetot is defined as a number with 3 decimal places >> >>The result should be 4.67 but shows 4.66 > > 4.66 is correct; Access uses "Banker's Rounding". A value ending in 5 will > round to the nearest *even* number, up or down, rather than always > rounding > up; this gives a more accurate result, since the average of a large set of > numbers will be closer to the average of the same set, rounded. The > "rounding > up" algorithm will make the results creep up. > > -- > > John W. Vinson [MVP]
From: Abay on 7 Feb 2010 21:19 Many thanks Stuart ... it works of course, yeah! Really appreciate your help. Abay "Stuart McCall" <smccall(a)myunrealbox.com> wrote in message news:ehvhuxFqKHA.3980(a)TK2MSFTNGP05.phx.gbl... > "Abay" <abcd(a)aol.com> wrote in message > news:%23QAeMeFqKHA.4532(a)TK2MSFTNGP05.phx.gbl... >> Hello, >> >> I am trying to round the results of a calculation without success. >> >> I would like the result of the following to round up to 2 decimal places. >> >> Dgst - dlinetot / 105 * 5 >> >> Dgst is defined as a number with 2 decimal places >> Dlinetot is defined as a number with 3 decimal places >> >> The result should be 4.67 but shows 4.66 >> >> I tried using the Round function (using the sytax from access help),as >> follows: >> >> round (dgst = dlinetot / 105 * 5 [,2]) or >> round (dgst=dlinetot/105 * 5, 2) and get an error msg "expected end of >> statement" >> >> I know I am doing something wrong .. so any help with this would be most >> appreciated. >> >> Abay > > Your 2nd try with the round function almost had it. Try: > > dgst = round(dlinetot/105 * 5, 2) > > This assigns the result from the round function to dgst. > >
|
Pages: 1 Prev: Turning on and off Data Entry Next: Create a bound class |