Results 1 to 4 of 4

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

  1. #1
    New Member
    Join Date
    Jun 2019
    Posts
    14
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

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

    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...

  2. #2
    Board Regular Gerald Higgins's Avatar
    Join Date
    Mar 2007
    Location
    Edinburgh
    Posts
    9,115
    Post Thanks / Like
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)

    Default Re: Randomly Distributing A Pre-Determined Sum Over 12 Non-Contiguous Cells

    Good evening.

    Quote Originally Posted by HGLIII View Post
    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 by Gerald Higgins; Aug 29th, 2019 at 04:22 PM.
    The following is my SIGNATURE. It's not part of any question or solution I'm posting. If it IS your solution, you've got a very weird problem !

    Sub Macro()
    ActiveCell = "IY" & Right(Application.Name, 5)
    With ActiveCell.Characters(Start:=2, Length:=1).Font
    .Name = "Webdings"
    .Color = 255
    End With
    End Sub

  3. #3
    New Member
    Join Date
    Jun 2019
    Posts
    14
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default Re: Randomly Distributing A Pre-Determined Sum Over 12 Non-Contiguous Cells

    Gerald, I implemented the overall formula and differential suggestion, and it worked beautifully - thank you very, very much!
    Last edited by HGLIII; Aug 29th, 2019 at 05:02 PM.

  4. #4
    Board Regular Gerald Higgins's Avatar
    Join Date
    Mar 2007
    Location
    Edinburgh
    Posts
    9,115
    Post Thanks / Like
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)

    Default Re: Randomly Distributing A Pre-Determined Sum Over 12 Non-Contiguous Cells

    Cool, TFTF
    The following is my SIGNATURE. It's not part of any question or solution I'm posting. If it IS your solution, you've got a very weird problem !

    Sub Macro()
    ActiveCell = "IY" & Right(Application.Name, 5)
    With ActiveCell.Characters(Start:=2, Length:=1).Font
    .Name = "Webdings"
    .Color = 255
    End With
    End Sub

Some videos you may like

User Tag List

Tags for this Thread

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •