Results 1 to 7 of 7
  1. #1
    Join Date
    Jun 2002
    Posts
    72

    Unanswered: rounding number down

    Is there a function in Access 2000 to round down a number, for example: 2.345 gets rounded down to 2.

  2. #2
    Join Date
    Feb 2002
    Posts
    403
    Round is the function you want.

    =Round(2.345,0) gives 2

  3. #3
    Join Date
    Jun 2002
    Posts
    72
    How do you round say 2.988 down to 2.

  4. #4
    Join Date
    Jun 2002
    Location
    Mpls/St.Paul area
    Posts
    303
    This is one way to do it. Place this function in a module.
    Call it and pass the number to truncate.

    Function gTrunk(OriginalNumber As Single ) As Integer

    gTrunk = OriginalNumber

    End Function

    ___________________________________________

    Call your function like this

    intTruncatedValue = gTrunk(12343.483)
    John
    This is the day the Lord has made, I will rejoice and be glad in it.

  5. #5
    Join Date
    Apr 2002
    Location
    Germany
    Posts
    228
    converting to integer will result in rounding (>.5 is rounded up, otherwise rounded down). Use the fix function to always round down. It does not have the side effect of data type conversion as well.

    usage:

    fix(9.876)

    will result in 9

  6. #6
    Join Date
    May 2002
    Location
    General Deheza, Cba, Arg.
    Posts
    276

    Re: rounding number down

    use the function int(xvar).
    this function return the integer of the xvar.

  7. #7
    Join Date
    Apr 2002
    Location
    Germany
    Posts
    228
    the int function has problems with negative values
    the Fix(n) function is defined as Sgn(n) * Int(Abs(n))

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •