+ Reply to Thread
Results 1 to 5 of 5

MROUND Rounding Issues (Rounding Down, Not Up)

  1. #1
    Registered User
    Join Date
    06-16-2015
    Location
    Sydney Australia
    MS-Off Ver
    2010
    Posts
    2

    MROUND Rounding Issues (Rounding Down, Not Up)

    Hi there,

    I've been experiencing some unexpected behaviour when using the MROUND function.

    I have a formula which rounds a dollar figure to the nearest x cents. For example I've been using
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    to round x to the nearest 10 cents.

    The formula works as expected most of the time, for example

    Formula: copy to clipboard
    Please Login or Register  to view this content.
    returns 205.3 and
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    returns 85.9

    The problem occurs when x is a multiple of 5 cents. In this situation I would expect Excel to round the value up, and the Microsoft support page for MROUND suggests that this is how the function should work

    MROUND rounds up, away from zero, if the remainder of dividing number by multiple is greater than or equal to half the value of multiple.
    In some situations this works e.g.
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    returns 6.2, however in others e.g.
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    returns 26.1.

    Any ideas what may be happening here? Any help would be greatly appreciated.

  2. #2
    Forum Expert
    Join Date
    08-02-2013
    Location
    Québec
    MS-Off Ver
    Excel 2003, 2007, 2013
    Posts
    1,412

    Re: MROUND Rounding Issues (Rounding Down, Not Up)

    Hello,
    This is a floating point conversion "problem". Excel stores numbers as "floating point"

    26.15 (decimal) is converted to 26.14999999999999857891452847979962825775146484375 (floating piont)
    6.15 (decimal) is converted to 6.1500000000000003552713678800500929355621337890625

    See these links:
    https://support.microsoft.com/en-us/kb/78113
    http://www.exploringbinary.com/float...int-converter/
    GC Excel

    If this post helps, then click the star icon (*) in the bottom left-hand corner of my post to Add reputation.

  3. #3
    Registered User
    Join Date
    06-16-2015
    Location
    Sydney Australia
    MS-Off Ver
    2010
    Posts
    2

    Re: MROUND Rounding Issues (Rounding Down, Not Up)

    Thanks GC,

    I wasn't aware of that, but it makes a lot of sense. I guess I'll have to look at other options.

    It's interesting that despite the floating point issue, using
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    returns the expected result.

  4. #4
    Forum Expert
    Join Date
    08-02-2013
    Location
    Québec
    MS-Off Ver
    Excel 2003, 2007, 2013
    Posts
    1,412

    Re: MROUND Rounding Issues (Rounding Down, Not Up)

    An other Excel mystery...

  5. #5
    Forum Guru MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Woodinville, WA
    MS-Off Ver
    Office 365
    Posts
    16,167

    Re: MROUND Rounding Issues (Rounding Down, Not Up)

    Could you add something to the number before rounding to insure it rounds in the correct direction? Perhaps always add .0001 to all the numbers before the round?
    One test is worth a thousand opinions.
    Click the * Add Reputation below to say thanks.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Replies: 3
    Last Post: 07-16-2014, 01:50 AM
  2. Issues with rounding
    By kasperblue in forum Excel General
    Replies: 2
    Last Post: 08-04-2012, 05:41 PM
  3. rounding issues
    By emt3000gt in forum Excel Formulas & Functions
    Replies: 12
    Last Post: 01-06-2008, 07:07 PM
  4. [SOLVED] rounding issues
    By [email protected] in forum Excel - New Users/Basics
    Replies: 1
    Last Post: 02-27-2006, 05:20 PM
  5. Rounding Issues
    By Louis in forum Excel General
    Replies: 1
    Last Post: 02-04-2005, 08:06 PM

Tags for this Thread

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1