+ Reply to Thread
Results 1 to 10 of 10

Rounding to whole numbers, divisible by 3 or 4 !

Hybrid View

  1. #1
    Registered User
    Join Date
    02-18-2019
    Location
    London, UK
    MS-Off Ver
    Office 365 Pro Plus
    Posts
    7

    Rounding to whole numbers, divisible by 3 or 4 !

    Howdy folks

    So I have a little formula table I use every day - it does some calculations and then spits out a number - I then manually round the number up or down to the nearest whole number divisible by 3 or by 4.

    For example, 88 I round to 90.

    112, round up to 120.

    44, to 45.

    Wondered if Excel could do that for me?

    Thanks.

  2. #2
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS 365 Family 64-bit 2502
    Posts
    26,993

    Re: Rounding to whole numbers, divisible by 3 or 4 !

    All of the numbers in your examples are divisible by 4. Why do you need to round them up if they are already divisible by 4? And rounding to the nearest multiple of 3 would require rounding down in the first two cases, to 87 and 111.
    Jeff
    | | |會 |會 |會 |會 | |:| | |會 |會
    Read the rules
    Use code tags to [code]enclose your code![/code]

  3. #3
    Forum Expert Greg M's Avatar
    Join Date
    08-16-2007
    Location
    Dublin. Ireland
    MS-Off Ver
    Office 2016
    Posts
    4,641

    Re: Rounding to whole numbers, divisible by 3 or 4 !

    Hi there,

    In your examples all values are rounded upwards, so following this approach, for a value in Cell A1 try using:

    
    =MIN(3 * INT((A1 + 3) / 3),  4 * INT((A1 + 4) / 4))

    Hope this helps - please let me know how you get on.

    Regards,

    Greg M

  4. #4
    Registered User
    Join Date
    02-18-2019
    Location
    London, UK
    MS-Off Ver
    Office 365 Pro Plus
    Posts
    7

    Re: Rounding to whole numbers, divisible by 3 or 4 !

    They are just random numbers picked out of thin air - I guess the answer would be so that the final number itself is rounded to the nearest 5.

    Have 77 instead (rounded to 80)

    So 88, if divided by 4 would be 22, I want it to be 25 or 30, therefore round it to 90 and divide by 3.

    Thanks.

  5. #5
    Registered User
    Join Date
    02-18-2019
    Location
    London, UK
    MS-Off Ver
    Office 365 Pro Plus
    Posts
    7

    Re: Rounding to whole numbers, divisible by 3 or 4 !

    Or maybe 77 would actually round down to 75! More likely in fact... you see how it gets complicated to formulate this.. at least to me!

  6. #6
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2010, 2019
    Posts
    40,689

    Re: Rounding to whole numbers, divisible by 3 or 4 !

    So I have a little formula table I use every day - it does some calculations and then spits out a number - I then manually round the number up or down to the nearest whole number divisible by 3 or by 4.

    For example, 88 I round to 90.

    112, round up to 120.

    44, to 45.
    Your examples don't follow your description; 88, 112, and 44 are all divisible by 4.
    Entia non sunt multiplicanda sine necessitate

  7. #7
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS 365 Family 64-bit 2502
    Posts
    26,993

    Re: Rounding to whole numbers, divisible by 3 or 4 !

    The description is not rigorous enough to provide an Excel solution. It sounds like a game of Fizzbin.

  8. #8
    Forum Guru
    Join Date
    04-13-2005
    Location
    North America
    MS-Off Ver
    2002/XP, 2007, 2024
    Posts
    16,438

    Re: Rounding to whole numbers, divisible by 3 or 4 !

    Short but useless answer -- yes, Excel can do this for you. As others have suggested, I'm not sure your description provides enough detail about the desired results, so it is difficult to come up with an algorithm.

    Combining the information in the OP and post #4, maybe you are looking to round (round up or round to nearest?) to a multiple of 5 that is also a multiple of 3 or 4. I think that would mean that the solution set would be the combined set of the multiples of 15 (0,15,30,45,60,75,...) and 20 (0,20,40,60,80,100,...) [combined set = (0,15,20,30,40,45,60,75,80,90,100,105,120,135,140,...)]. Is that correct?

    Whether that is exactly correct or not, a brute force approach might be to make a list of all the allowed results, then use a lookup function (probably MATCH() https://support.office.com/en-us/art...9-533f4a37673a ) with one of the the "approximate match" options (3rd argument of MATCH() is +1 or -1) to look up the result. For something like "round up to the nearest multiple of 15 or 20", I could have a list of all possible values (in descending order), then use =INDEX(list in descending order,MATCH(value,list in descending order,-1)) and that should work for that scenario.
    Quote Originally Posted by shg
    Mathematics is the native language of the natural world. Just trying to become literate.

  9. #9
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2010, 2019
    Posts
    40,689

    Re: Rounding to whole numbers, divisible by 3 or 4 !

    I think MrS has broken the code:

    A
    B
    C
    1
    Nearest up:
    2
    88
    90
    B2: =MIN(CEILING(A2, {15,20}))
    3
    112
    120
    4
    45
    45
    5
    77
    80
    6
    7
    Nearest up or down:
    8
    88
    90
    B8: =IF(ABS(MROUND(A8, 15) - A8) < ABS(MROUND(A8, 20) - A8), MROUND(A8, 15), MROUND(A8, 20))
    9
    112
    105
    10
    45
    45
    11
    77
    75


    Good mindreading
    Last edited by shg; 02-18-2019 at 08:00 PM.

  10. #10
    Registered User
    Join Date
    02-18-2019
    Location
    London, UK
    MS-Off Ver
    Office 365 Pro Plus
    Posts
    7

    Re: Rounding to whole numbers, divisible by 3 or 4 !

    Thanks for your help, I'll give it a go!

+ 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: 4
    Last Post: 12-17-2015, 12:33 AM
  2. [SOLVED] Rounding up and down to numbers divisible by 6
    By The Man With No Name in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 07-31-2014, 03:45 PM
  3. [SOLVED] Show only numbers divisible to one
    By Armannn in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 04-22-2014, 11:56 PM
  4. numbers divisible by 20%
    By sjc619 in forum Excel General
    Replies: 6
    Last Post: 11-17-2011, 02:35 PM
  5. Replies: 5
    Last Post: 10-21-2005, 03:05 AM
  6. Rounding a Value to Make It Divisible by a Specified Number
    By John Nash in forum Tips and Tutorials
    Replies: 1
    Last Post: 08-29-2005, 10:53 AM
  7. How get true response when numbers divisible by 12?
    By lax_fan in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 05-16-2005, 07:06 PM

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