# Randomly Distributing A Pre-Determined Sum Over 12 Non-Contiguous Cells

#### HGLIII

##### New Member
Good Afternoon,

Does anyone know of a way to distribute a certain number (say 25,000,000) over a group of non-contiguous cells, while adhering to a floor, or minimum number, for each respective cell? Also, formulas in the past have been "biased" toward the upper-most positioned cells (so that the distribution falls unevenly, skewed toward the first 2 or 3 cells), so we would need to avoid that if possible.

Looking for something along the lines of:

Total Sum: 25,000,000
Minimum Increments: 100,000

1. 5,000,000
2. 7,500,000
3. 100,000
4. 1,300,000
5. 11,100,000
etc.

Thanks very much!

HGL

P.S. - I know some members have kindly offered their help in the past, but for some reason none of the suggestions seem to end up working. Perhaps this is impossible...

#### Gerald Higgins

##### Well-known Member
Good evening.

P.S. - I know some members have kindly offered their help in the past, but for some reason none of the suggestions seem to end up working. Perhaps this is impossible...
In that case it might have been helpful to say what you've already tried, and in what way it didn't work.

Anyway, here's one idea.

In A1 - Total Sum Value
In A2 - Minimum Increments Value

In B1
=rand()

Copy this down for however many values you want, let's say 5, so =rand() is in every cell in B1:B5.

In C1
Code:
``=ROUND(A\$1*(B1/SUM(B\$1:B\$5)),-LOG(A\$2))``
And copy down as far as required, in this case C1:C5.

Note that this won't ALWAYS sum exactly back to the Total Sum, because of the way that the rounding works.
A crude way to correct this would be to make one of the values be a simple differential between the sum of all the other values, and the Total Sum.

Last edited:

#### HGLIII

##### New Member
Gerald, I implemented the overall formula and differential suggestion, and it worked beautifully - thank you very, very much!

Last edited:

Cool, TFTF

1,081,981
Messages
5,362,535
Members
400,679
Latest member
alecalec202

### This Week's Hot Topics

• populate from drop list with multiple tables
Hi All, i have a drop list that displays data, what i want is when i select one of those from the list to populate text from different tables on...
• Find list of words from sheet2 in sheet1 before a comma and extract text vba
Hi Friends, Trying to find the solution on my task. But did not find suitable one to the need. Here is my query and sample file with details...
• Dynamic Formula entry - VBA code sought
Hello, really hope one of you experts can help with this - i've spent hours on this and getting no-where. .I have a set of data (more rows than...