I have data like this:
A B C D
Book1 1 49
2 37
3 31
4 46 163
5 35
6 47
7 40
8 38 160
9 45
10 25
11 38
12 29
13 25
14 18 180
where column D contains subtotals for (variable) numbers of items from column C.
What I'm trying to accomplish is, given a set number of these subtotals, have each be as close to their average as possible (which may be true for the small sample, but not necessarily in the larger table). In other words, if the total of the items in column C is 15,000 and I want to divide them into 90 parts, then each of those parts should be as close as possible to 166.67 (15,000/90).
The order of ColumnC may not be changed.
How might this be accomplished? (VBA will work for me, if needs be.)