PDA

View Full Version : Run "x" number of random draws and calculate totals against a pre-defined set.



PAB
01-21-2017, 06:49 AM
Good afternoon,

What I basically want to do it to run a certain number of random combinations as input by the user via an input box.
The combinations are in the format of 6 numbers plus an extra bonus number without repitition from a pool of 59 numbers.
I would like the program to pick up the 6 numbers to check against from cells C4:H4 within the Worksheet.
I would then like the program to calculate the total matches for each random combination that matched the 6 number combination in cells C4:H4 in the format:

0 Matches
0 Matches + Extra Bonus Number
1 Matches
1 Matches + Extra Bonus Number
2 Matches
2 Matches + Extra Bonus Number
3 Matches
3 Matches + Extra Bonus Number
4 Matches
4 Matches + Extra Bonus Number
5 Matches
5 Matches + Extra Bonus Number
6 Matches

So for each random combination it will calculate the criteria above and at the end it will add all of same criteria together to give one line of results.
This will produce a single row of totals for each of the criteria above to go into cells C7:O7.
I think it could possibly involve If...Then...Else If (several of)...Else...End If, but I don't know how to go about this or how to get this to work.

It is basically a way of running "x" number of random draws against a pre-defined set of 6 numbers and producing the overall results for each of the criteria stated in a single row from cells C7:O7.

I hope I have explained this clearly enough.

I have also posted this along with a couple of more posts here: https://www.mrexcel.com/forum/excel-questions/986723-run-x-number-random-draws-calculate-totals-against-pre-defined-set.html

Thanks in advance.

TheSilkCode
01-21-2017, 01:34 PM
Take a shot at the code and then let us know where you get stuck.