1 Column, 1254 cells, Create buckets of summed amounts

Beetlestone

New Member
Joined
Jan 7, 2014
Messages
2
I put this on a smaller scale of 28 rows to describe it easier.
This cannot be a macro (VBA), has to be a good old fashioned formula :)

I have 1 column (A) with 1254 cells, each cell contains tonnage. In column B, I am trying to create "buckets" of tonnage from column A that sum up to just below 10,000, and also distribute the same number of cells in each "bucket".

That means I cant simply add up consecutive cells (ex:B1 - B12 results in 9,841). Rather I need to efficiently distribute the tonnage so that each group (or bucket) has a similar number of cells in it.

Below column B is the result I am trying to achieve, any help on this is greatly appreciated!

AB
1TonnageBucket
2634.91406251
31729.059571
4931.98632812
51076.2587893
6417.06054692
73323
86013
9827.40527343
104942
1121533
12644.58593752
133131
1420843
1501
161753.6767583
171376.4648441
185.6552734381
1915702
204233
211992
2221221
231091.4492191
2403
2525272
261781
27539.93752
28699.58886723

<tbody>
</tbody>

<tbody>
</tbody>
 

Excel Facts

Move date out one month or year
Use =EDATE(A2,1) for one month later. Use EDATE(A2,12) for one year later.
I'm not saying what you are asking is impossible, but with formulas, I think it would be pretty near it.

The only route I can think of is to create a separate table where you sort the tonnages and bucket 1 would have the highest + lowest + ... + ... until tonnage is more or less reached.

However, the part that makes it nearly impossible (in my mind) is there would be no way to know in the beginning how many buckets there would need to be or even how many items would be in each bucket.

There are some VERY clever people on this forum though so perhaps someone will come up with something that will blow my mind.
 
Upvote 0
However, the part that makes it nearly impossible (in my mind) is there would be no way to know in the beginning how many buckets there would need to be or even how many items would be in each bucket.

I was thinking

BUCKETS=ROUNDUP(SUM(A:A),0)
ITEMS=COUNT(A:A)/BUCKETS

But that's as far as I got, in regard to the full solution, I'm adding my vote to the borderline impossible pile.

To get a result, in my mind, would require cycling through all possible permutations until everything fits. Even using vba, I expect that the sun will run out of hydrogen before it finished processing.
 
Upvote 0
This is the bet I could come up with (requires sorting by tonnage first

TonnageBucket Buckets
01 3
02
5.65533
1783
1992
3131
3321
417.062
4233
4943
539.942
6011
634.911
644.592
699.593
827.413
931.992
1076.31
1091.41
1376.52
15703
1729.13
1753.72
20841
21221
21532
25273
<colgroup><col width="64" style="width: 48pt;" span="5"> <tbody> </tbody>


Formula for E2 =ROUNDUP(SUM(A2:A28)/10000,0)
For b2 and down =IF(ISEVEN(INT((ROWS(A$2:A2)-1)/E$2)),MOD(ROWS(A$2:A2)+E$2-1,E$2)+1,E$2-MOD(ROWS(A$2:A2)+E$2-1,E$2))
 
Upvote 0

Forum statistics

Threads
1,214,785
Messages
6,121,543
Members
449,038
Latest member
Guest1337

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top