One formulas play to try ..
First, sort the data in ascending order by percentage from left to right
eg in A1:D2 would be:
oranges bananas apples pears
10% 20% 30% 40%
Enter a zero in A3
Put in B3: =SUM($A$2:A2)
Copy B3 to D3
Then place in any cell, say in A5:
=INDEX($A$1:$D$1,MATCH(RAND(),$A$3:$E$3,1))
A5 will generate the required "weighted" random draw which takes into
account the commensurate chances by each fruit's percentage. This is achieved
via the cumulative percentages in A3:D3 which produces the unique
"buckets/tiers" corresponding to the sorted percentages in A2:D2. Press F9 to
re-generate.
--
Max
Singapore
http://savefile.com/projects/236895
xdemechanik
---
"mslabbe" wrote:
I'm trying to figure out away that I can randomly pick an item from a range
and have the random function be weighted. So lets say in cell A1 = apples,
B1 = bananas, C1 = pears and D1 = oranges. In the cells below them are there
chances, the higher the %, the better the chance it will be selected. So for
instance, A2 = 30%, B2 = 20%, C2 = 40% and D2 = 10%. So, C2 has the best
chance at being randomly selected.
Anyone have any ideas on how to accomplish this? I really do not know where
to even begin. So, any help or ideas would be greatly appreciated.