Consulting

Results 1 to 5 of 5

Thread: Solved: Round down to nearest 5,000

  1. #1
    VBAX Mentor
    Joined
    Aug 2011
    Posts
    353
    Location

    Solved: Round down to nearest 5,000

    Is there a way to roundown to the nearest 5,000?

    So if its 8,000 - that would be rounded down to 5,000
    If its 480,000 - that would be rounded down 450,000

    and if its below 5,000 - round down to zero


    Any ideas?

    I know about the rounddown function but am not sure what to put in there to make it round down to the nearest 5,000?

  2. #2
    VBAX Mentor
    Joined
    Feb 2009
    Posts
    493
    Location
    I believe you need the analysis pack installed for this. I got this from a google search.

    =MROUND((A1-5000/2),5000)
    -----------------------------------------
    The more you learn about something the more you know you have much to learn.

  3. #3
    VBAX Expert CatDaddy's Avatar
    Joined
    Jun 2011
    Posts
    581
    Location
    roundedInteger = (CInt(unroundedNumber)/5000)*(5000)
    integer division uses whole numbers so the result of an integer divided by 5000 will be the largest whole number quotient (the modulus would give the remainder of this division)
    ------------------------------------------------
    Happy Coding my friends

  4. #4
    Mac Moderator VBAX Guru mikerickson's Avatar
    Joined
    May 2007
    Location
    Davis CA
    Posts
    2,778
    How about =FLOOR(A1, 5000)

  5. #5
    VBAX Mentor
    Joined
    Aug 2011
    Posts
    353
    Location
    This one works too!

    =FLOOR(A1, 5000)

    Thanks for the help!

Posting Permissions

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