+ Reply to Thread
Results 1 to 6 of 6

Equal distribution of list items with VBA

  1. #1
    Registered User
    Join Date
    10-16-2012
    Location
    Finland
    MS-Off Ver
    Excel 2007
    Posts
    15

    Equal distribution of list items with VBA

    Hi,

    The problem is as follows:

    There is a table with data in it. There is one column (B) called "Entry Count" that has numbers between 1-50.

    The goal is to distribute each row to certain employee as equally as possible on the basis on the entry count. So at the end, when each row of a table has been appointed, all employees have equal sum of the Column B values.

    There can be any number of employees between 2-15


    I thought that one way would be to sum total values for each employee each row and then assign for the next row the employee that has the least points. But I've got no idea how to do that in VBA.

    Any help will be appreciated. Thanks in advance.

  2. #2
    Forum Expert MickG's Avatar
    Join Date
    11-23-2007
    Location
    Banbury,Oxfordshire
    Posts
    2,650

    Re: Equal distribution of list items with VBA

    You need to attach a example file , showing data"Before" running code and Data "After" running code. !!!!!

  3. #3
    Registered User
    Join Date
    10-16-2012
    Location
    Finland
    MS-Off Ver
    Excel 2007
    Posts
    15

    Re: Equal distribution of list items with VBA

    You are right, should have added an attachment in the first place.

    Please see the attachment now. Hope it clarifies a bit what I'm trying to achieve.
    Attached Files Attached Files

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

    Re: Equal distribution of list items with VBA

    How about just a formula?

    Row\Col
    B
    C
    D
    E
    F
    G
    H
    I
    J
    K
    L
    1
    Alan
    Barb
    Cain
    Dana
    Eric
    2
    Count
    Report Id
    Date
    Name
    0
    0
    0
    0
    0
    3
    17
    4FBA019EDB1D42B5A0E5
    25-Jun-15
    Alan
    17
    0
    0
    0
    0
    E3 and down: =INDEX($F$1:$J$1, MATCH(MIN(F2:J2), F2:J2, 0))
    4
    2
    D91E08AB00304587B734
    25-Jun-15
    Barb
    17
    2
    0
    0
    0
    F3 and across and down: =F2 + $B3 * ($E3=F$1)
    5
    4
    ED121025939046E2AC47
    24-Jun-15
    Cain
    17
    2
    4
    0
    0
    6
    12
    0DF329451F2B4D12A606
    26-Jun-15
    Dana
    17
    2
    4
    12
    0
    7
    4
    7BF5FF20998947CA88E7
    25-Jun-15
    Eric
    17
    2
    4
    12
    4
    8
    40
    EEF9EE37C03A4DD590F4
    25-Jun-15
    Barb
    17
    42
    4
    12
    4
    9
    9
    C403547BE874456E9545
    26-Jun-15
    Cain
    17
    42
    13
    12
    4
    10
    3
    5F3494D66A684F25B427
    26-Jun-15
    Eric
    17
    42
    13
    12
    7
    11
    9
    6B30EFFBE0FF42A3BE58
    26-Jun-15
    Eric
    17
    42
    13
    12
    16
    12
    12
    883FAB2666BC48239996
    26-Jun-15
    Dana
    17
    42
    13
    24
    16
    13
    7
    3C4203A0A7C8458D8EF8
    26-Jun-15
    Cain
    17
    42
    20
    24
    16
    14
    13
    04C5538BE5AE4B658FE7
    26-Jun-15
    Eric
    17
    42
    20
    24
    29
    15
    8
    21C2EA1803984E75BFE5
    26-Jun-15
    Alan
    25
    42
    20
    24
    29
    16
    10
    CB5C11DA82CE4EFF9569
    24-Jun-15
    Cain
    25
    42
    30
    24
    29
    17
    3
    B51C8D81E6A84CFB8303
    24-Jun-15
    Dana
    25
    42
    30
    27
    29
    18
    22
    F18BF15BAB9A44A9B8B9
    23-Jun-15
    Alan
    47
    42
    30
    27
    29
    19
    7
    E88D06B9E0794D28A482
    23-Jun-15
    Dana
    47
    42
    30
    34
    29
    20
    15
    D478CD92172740B68DB9
    23-Jun-15
    Eric
    47
    42
    30
    34
    44
    21
    11
    C2B9EE404D6B4BBA8FBA
    23-Jun-15
    Cain
    47
    42
    41
    34
    44
    22
    2
    382F87121BBE410C95CB
    22-Jun-15
    Dana
    47
    42
    41
    36
    44
    23
    1
    69F78DE703CF494ABDEF
    22-Jun-15
    Dana
    47
    42
    41
    37
    44
    24
    8
    E6E1EAA916244A62AEE3
    22-Jun-15
    Dana
    47
    42
    41
    45
    44
    25
    3
    080066DA857C4E9CBBFB
    21-Jun-15
    Cain
    47
    42
    44
    45
    44
    26
    5
    8E3CCB8659FC4AC29931
    21-Jun-15
    Barb
    47
    47
    44
    45
    44
    27
    2
    2C4051389FD34E65BDF1
    21-Jun-15
    Cain
    47
    47
    46
    45
    44
    28
    3
    631F5F4017284E7C9F80
    21-Jun-15
    Eric
    47
    47
    46
    45
    47
    29
    3
    7B235D4CB2C34E629F32
    21-Jun-15
    Dana
    47
    47
    46
    48
    47
    30
    1
    EAD1577A93584D988C3E
    21-Jun-15
    Cain
    47
    47
    47
    48
    47
    31
    4
    A47A3A9B15844F13B25C
    20-Jun-15
    Alan
    51
    47
    47
    48
    47
    32
    9
    97D5B5911C014A1384E5
    19-Jun-15
    Barb
    51
    56
    47
    48
    47
    33
    9
    52F3A55F1ADD4A7CA714
    18-Jun-15
    Cain
    51
    56
    56
    48
    47
    34
    6
    BB61648DC072413EA803
    18-Jun-15
    Eric
    51
    56
    56
    48
    53
    35
    7
    080CB58594AD4395A98A
    18-Jun-15
    Dana
    51
    56
    56
    55
    53
    36
    7
    130FE97556794EF6AA2F
    17-Jun-15
    Alan
    58
    56
    56
    55
    53
    Entia non sunt multiplicanda sine necessitate

  5. #5
    Registered User
    Join Date
    10-16-2012
    Location
    Finland
    MS-Off Ver
    Excel 2007
    Posts
    15

    Re: Equal distribution of list items with VBA

    Yes, that works brilliantly.

    It's insane how fast you can get answers at this forum. Thousand thanks man.

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

    Re: Equal distribution of list items with VBA

    You're welcome.

    The results will be more uniform if you sort the items descending by size.

+ 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. distribution of percentage if 2 items deleted
    By senjuti.sarkar in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 02-16-2014, 06:39 AM
  2. Calculating equal distribution
    By newbie4 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 09-10-2012, 02:00 PM
  3. Equal Distribution Of Funds Question
    By Brandens in forum Excel General
    Replies: 1
    Last Post: 11-15-2011, 03:10 PM
  4. Replies: 0
    Last Post: 06-08-2011, 04:30 PM
  5. Replies: 1
    Last Post: 10-27-2010, 02:01 AM

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