+ Reply to Thread
Results 1 to 4 of 4

Distribute rows equally & roundup function mess

  1. #1
    Registered User
    Join Date
    05-17-2014
    MS-Off Ver
    Excel 2003
    Posts
    2

    Distribute rows equally & roundup function mess

    Hi guys,
    I have digging around this one for a while now, let me explain. I am trying to split a list according to the amount of people available on this day. So in my sheet I have X number of rows and Z number of person. X/Z will give me the amount of rows by person, easy, it works fine (the final goal is to color each block of row for each people).

    My issue is the following : Let say I have 24 rows and 10 people, the roundup function gives me 2 rows by person, and I get 10 times 2 row = 20 rows, how to distribute the last missing 4 rows ?
    My idea would be to have 8 x 2rows + 2 x 4rows = 24 rows
    I cannot figure out the mathematic way to handle this case.

    i have included my code below (I define staff and TotalRows, and it colors the rows accordingly)

    * All my datas are entered in Col A, from cell A5, that's why I have a firstrow=5

    Please Login or Register  to view this content.
    Thanks for your help !
    Oli
    Last edited by oli_g; 07-27-2014 at 10:16 AM. Reason: replace my sheet's name with Sheet1

  2. #2
    Forum Expert
    Join Date
    07-15-2012
    Location
    Leghorn, Italy
    MS-Off Ver
    Excel 2010
    Posts
    3,431

    Re: Distribute rows equally & roundup function mess

    can you attach a sample file with data and desired output ?
    If solved remember to mark Thread as solved

  3. #3
    Forum Guru HaHoBe's Avatar
    Join Date
    02-19-2005
    Location
    Hamburg, Germany
    MS-Off Ver
    work: 2016 on Win10 (notebook), private: 365 on Win11 (desktop), 2019 on Win11 (notebook)
    Posts
    8,198

    Re: Distribute rows equally & roundup function mess

    Hi, oli_g,

    maybe have a look at this code:
    Please Login or Register  to view this content.
    Ciao,
    Holger
    Use Code-Tags for showing your code: [code] Your Code here [/code]
    Please mark your question Solved if there has been offered a solution that works fine for you

  4. #4
    Registered User
    Join Date
    05-17-2014
    MS-Off Ver
    Excel 2003
    Posts
    2

    Re: Distribute rows equally & roundup function mess

    Awesome Holger, that's exactly what I was looking for.
    Thanks for the quick answer (and the clean code)

+ 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. Distribute no of account and amount equally to callers
    By Apple Ling in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-24-2014, 06:34 AM
  2. [SOLVED] Macro to divide a range and insert them in new rows equally
    By Netaji in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-07-2014, 09:51 AM
  3. Replies: 15
    Last Post: 12-13-2013, 08:23 AM
  4. distribute names equally in front of numbers
    By rahulbawkar2006 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 12-20-2011, 06:18 AM
  5. Split rows equally in columns
    By cooksterni in forum Excel General
    Replies: 1
    Last Post: 06-26-2011, 10:46 AM

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