Round

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Arie

    #1

    Round

    Hello,

    I have a table with marks (from Exams) and when I create a query a
    calculated field with an expression like:

    Round([mark1]+ [mark2])/2

    I am confronted with the problem that Access has a strange outcome.

    For instance:

    (4+5)/2 returns 4
    (5+6)/2 returns 6

    Who can help me solving this problem? Thanks


  • Marshall Barton

    #2
    Re: Round

    Arie wrote:
    >I have a table with marks (from Exams) and when I create a query a
    >calculated field with an expression like:
    >
    >Round([mark1]+ [mark2])/2
    >
    >I am confronted with the problem that Access has a strange outcome.
    >
    >For instance:
    >
    >(4+5)/2 returns 4
    >(5+6)/2 returns 6

    But, that's what Round() does. It's cakked Bankers Rounding
    because it minimizes the rounding errors when adding a
    column of values.

    What result do you expect, 5 and 6, like we were taught in
    grade school? If so, then try using the expression:
    Int((mark1+ mark2) / 2 + .5)

    --
    Marsh

    Comment

    • bhicks11

      #3
      Re: Round

      On Sep 15, 6:17 pm, Marshall Barton <marshbar...@wo wway.comwrote:
      Arie wrote:
      I have a table with marks (from Exams) and when I create a query a
      calculated field with an expression like:
      >
      Round([mark1]+ [mark2])/2
      >
      I am confronted with the problem that Access has a strange outcome.
      >
      For instance:
      >
      (4+5)/2 returns 4
      (5+6)/2 returns 6
      >
      But, that's what Round() does.  It's cakked Bankers Rounding
      because it minimizes the rounding errors when adding a
      column of values.
      >
      What result do you expect, 5 and 6, like we were taught in
      grade school?  If so, then try using the expression:
              Int((mark1+ mark2) / 2 + .5)
      >
      --
      Marsh
      Hi Marsh, she is getting a round up in one case and a round down in
      the other?

      Bonnie
      Data entry services, data entry and database programming services since 1992. Security, accuracy, and reasonable pricing. (678) 773-6504

      Comment

      • Marshall Barton

        #4
        Re: Round

        bhicks11 wrote:
        >On Sep 15, 6:17 pm, Marshall Barton <marshbar...@wo wway.comwrote:
        >Arie wrote:
        >I have a table with marks (from Exams) and when I create a query a
        >calculated field with an expression like:
        >>
        >Round([mark1]+ [mark2])/2
        >>
        >I am confronted with the problem that Access has a strange outcome.
        >>
        >For instance:
        >>
        >(4+5)/2 returns 4
        >(5+6)/2 returns 6
        >>
        >But, that's what Round() does.  It's cakked Bankers Rounding
        >because it minimizes the rounding errors when adding a
        >column of values.
        >>
        >What result do you expect, 5 and 6, like we were taught in
        >grade school?  If so, then try using the expression:
        >        Int((mark1+ mark2) / 2 + .5)
        >
        >Hi Marsh, she is getting a round up in one case and a round down in
        >the other?

        As I said before, that's what Bankers Rounding does.
        Specifically, it rounds to the nearest even number in the
        next (to the left) position. E.g. 4.5 rounds to 4, 5.5
        rounds to 6, 6.5 round to 6, 7.5 rounds to 8, etc. Then, if
        you sum a column of those rounded values, the total will be
        more accurate than always rounding the midpoint fraction up.

        --
        Marsh

        Comment

        Working...