Tags: access, calculated, database, fee, microsoft, mysql, number, oracle, point, report, rounding, rounds, services, sql, view, worksperfectly

Rounding Up To Even number

On Database » Microsoft Access

1,872 words with 1 Comments; publish: Tue, 03 Jun 2008 22:56:00 GMT; (25062.50, « »)

This is the best one yet. I have a Fee for services on my report. It works

perfectly from my point of view. It rounds the calculated fee from $545.52 to

$546.

My boss says he wants it to round up to the nearest "even" dollar amount,

since they bill in two equal installments. I suggested charging 50 cents, but

they want to keep it to dollars.

Here is the formula now: =Sum([Proj_save])*([Mgmt_fee])

Can someone help me with how to make it round up to 0,2,4,6,8?

In Excel it is =EVEN(1.5) rounds 1.5 to the nearest even integer 2; =EVEN(3)

rounds 3 up to the nearest even integer 4; =EVEN(2) rounds 2 up to the

nearest even integer 2; and =EVEN(-1) rounds -1 up to the nearest even

integer (-2).

All Comments

Leave a comment...

  • 1 Comments
    • Novice2000 wrote:

      >This is the best one yet. I have a Fee for services on my report. It works

      >perfectly from my point of view. It rounds the calculated fee from $545.52 to

      >$546.

      >My boss says he wants it to round up to the nearest "even" dollar amount,

      >since they bill in two equal installments. I suggested charging 50 cents, but

      >they want to keep it to dollars.

      >Here is the formula now: =Sum([Proj_save])*([Mgmt_fee])

      >Can someone help me with how to make it round up to 0,2,4,6,8?

      >In Excel it is =EVEN(1.5) rounds 1.5 to the nearest even integer 2; =EVEN(3)

      >rounds 3 up to the nearest even integer 4; =EVEN(2) rounds 2 up to the

      >nearest even integer 2; and =EVEN(-1) rounds -1 up to the nearest even

      >integer (-2).

      Access doesn't have an Even function so you'll have to

      create your own:

      Public Function MyEven(x As Variant) As Variant

      If (IsNull(x) Or Int(x/2) = x/2) Then

      MyEven = x

      Else

      MyEven = Fix((X+2)/2)*2

      End If

      End Function

      Marsh

      MVP [MS Access]

      #1; Tue, 03 Jun 2008 22:58:00 GMT