+ Reply to Thread
Results 1 to 6 of 6

Joint CEILING and FLOOR for several cells

  1. #1
    Registered User
    Join Date
    02-23-2011
    Location
    London, England
    MS-Off Ver
    Excel 2010
    Posts
    5

    Joint CEILING and FLOOR for several cells

    Hello once again!

    I’m looking for a VBA code or Excel formula that combined both CEILING and FLOOR functions. My calculations require that I add, divide, or multiply a set of numbers that must always add up to 100%. Unfortunately, due to the rounding that occurs at other steps in the calculations, the summing and averageing does not always add up to 100%, often ending up at 99% or 101%.

    Could someone help me ensure that the values in, say, 5 different cells, when calculated from other cells, systematically add up to 100%? Like I said, a macro or regular function to do this would suit me perfectly.

    Thanks for the help!

    All the best,

    Calypso
    Last edited by ogygiasylph; 02-23-2011 at 01:10 PM. Reason: Problem solved

  2. #2
    Forum Expert sweep's Avatar
    Join Date
    04-03-2007
    Location
    Great Sankey, Warrington, UK
    MS-Off Ver
    2003 / 2007 / 2010 / 2016 / 365
    Posts
    3,454

    Re: Joint CEILING and FLOOR for several cells

    Hi,

    You could avoid using the FLOOR and CEILING rounding functions at all, and simply change the number format of the cells to specific decimal places?
    Rule 1: Never merge cells
    Rule 2: See rule 1

    "Tomorrow I'm going to be famous. All I need is a tennis racket and a hat".

  3. #3
    Registered User
    Join Date
    02-23-2011
    Location
    London, England
    MS-Off Ver
    Excel 2010
    Posts
    5

    Re: Joint CEILING and FLOOR for several cells

    But that still would automatically round it up or down to the nearest decimal, wouldn't it?

  4. #4
    Forum Expert sweep's Avatar
    Join Date
    04-03-2007
    Location
    Great Sankey, Warrington, UK
    MS-Off Ver
    2003 / 2007 / 2010 / 2016 / 365
    Posts
    3,454

    Re: Joint CEILING and FLOOR for several cells

    Only if you're only talking about the final calculations. Remove any rounding from your earlier calculations and you should be OK. (see sheet 1 of attachment)
    Attached Files Attached Files

  5. #5
    Forum Expert sweep's Avatar
    Join Date
    04-03-2007
    Location
    Great Sankey, Warrington, UK
    MS-Off Ver
    2003 / 2007 / 2010 / 2016 / 365
    Posts
    3,454

    Re: Joint CEILING and FLOOR for several cells

    Failing that, you could simply calculate out the error and maintain the ratio:
    Attached Files Attached Files

  6. #6
    Registered User
    Join Date
    04-22-2006
    Posts
    29

    Re: Joint CEILING and FLOOR for several cells

    Please insert a sample of your worksheet

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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