Forum Discussion
Distribution of one number over different categories with specific probabilities per category
- May 12, 2024
Lowbaer OK, so you want to generate 6 random percentages that add up to 100%.
In older versions of Excel, use =RAND() in 6 cells and then express each of these as a percentage of their sum. Or if you have a modern Excel version that supports dynamic arrays you could use something like below to spill 6 percentages in one go.
=LET( r, RANDARRAY(1, 6), s, SUM(r), TRANSPOSE( INDEX(r, 1, SEQUENCE(6)) / s ) )The attached file contains both solutions.
Lowbaer Taking a wild guess now, but perhaps something like this?
Formula was B3 dragged across to G3. Can be dragged down if needed.
- LowbaerMay 12, 2024Copper Contributor
Thanks for the idea! It would work perfectly to distribute the points over the categories at different proportions, but it lacks the element of randomness. I'd love to have some sort of random generator, which distributes the points over the categories with different probabilities per category. I've tried to play with if, rand and rank formulas but couldn't get anything to work that way.
- Riny_van_EekelenMay 12, 2024Platinum Contributor
Lowbaer OK, so you want to generate 6 random percentages that add up to 100%.
In older versions of Excel, use =RAND() in 6 cells and then express each of these as a percentage of their sum. Or if you have a modern Excel version that supports dynamic arrays you could use something like below to spill 6 percentages in one go.
=LET( r, RANDARRAY(1, 6), s, SUM(r), TRANSPOSE( INDEX(r, 1, SEQUENCE(6)) / s ) )The attached file contains both solutions.
- LowbaerMay 12, 2024Copper ContributorThats pretty much it! I've taken your formula of the first solution, added a range to the random formula around my desired percentage per category and multiplied the resulting "controlled" random percentages with the total amount of points to be distributed. This does the job, thank you!