Randomised 7 patterns out of 9

Kishan

Well-known Member
Joined
Mar 15, 2011
Messages
1,648
Office Version
  1. 2010
Platform
  1. Windows
Randomised 7 patterns out of 9</SPAN></SPAN>

Using Excel 2000</SPAN></SPAN>
Hi,</SPAN></SPAN>

VBA, which can choose "7 random patterns" out of 9 from a My List of column A, and make a list of random in the 7 columns E:K as number of random rows are set in the cell B1</SPAN></SPAN>

Example data show 12 random as per B1 value </SPAN></SPAN>


Book1
ABCDEFGHIJKL
1My List12P1P2P3P4P5P6P7
21|11|12|22|22|X1|12|2X|1
31|XX|11|22|1X|2X|12|11|X
4X|12|12|21|1X|2X|X2|11|X
51|2X|X2|XX|21|XX|21|2X|2
62|12|12|1X|11|12|12|XX|1
7X|22|11|XX|2X|11|1X|X1|X
82|X2|2X|12|X2|22|11|12|1
9X|X1|11|21|21|12|12|12|X
102|22|22|21|11|22|X2|22|1
111|X1|XX|XX|XX|XX|X2|1
121|2X|X2|1X|11|11|21|X
131|22|XX|XX|11|22|11|1
14
15
16
Sheet5


Thank you in advance</SPAN></SPAN>

Regards,</SPAN>
Kishan</SPAN></SPAN>
 
Last edited:

Excel Facts

Highlight Duplicates
Home, Conditional Formatting, Highlight Cells, Duplicate records, OK to add pink formatting to any duplicates in selected range.
Here's a non VBA solution.

Insert this formula into cell E2 and copy across to K2 and down as far as required

=IF((ROW()+1)<=$B$1,INDEX($A$2:$A$10,ROUNDDOWN(L2*9,0)+1),"")

Test this before relying on it.
 
Upvote 0
Here's a non VBA solution.

Insert this formula into cell E2 and copy across to K2 and down as far as required

=IF((ROW()+1)<=$B$1,INDEX($A$2:$A$10,ROUNDDOWN(L2*9,0)+1),"")

Test this before relying on it.
Hi Gerald Higgins, I am getting results as shown below, done as you explain (Insert this formula into cell E2 and copy across to K2 and down as far as required)</SPAN></SPAN>


Book1
ABCDEFGHIJKL
1My List12P1P2P3P4P5P6P7
21|11|11|11|11|11|11|11|1
31|X1|11|11|11|11|11|11|1
4X|11|11|11|11|11|11|11|1
51|21|11|11|11|11|11|11|1
62|11|11|11|11|11|11|11|1
7X|21|11|11|11|11|11|11|1
82|X1|11|11|11|11|11|11|1
9X|X1|11|11|11|11|11|11|1
102|21|11|11|11|11|11|11|1
111|11|11|11|11|11|11|1
12
13
14
15
16
Sheet5
Cell Formulas
RangeFormula
E2=IF((ROW()+1)<=$B$1,INDEX($A$2:$A$10,ROUNDDOWN(L2*9,0)+1),"")


Thank you for your help</SPAN></SPAN>

Regards,</SPAN></SPAN>
Moti</SPAN></SPAN>
 
Last edited:
Upvote 0
Sorry, there was a mistake in my post.

Try this . . .

=IF((ROW()+1)<=$B$1,INDEX($A$2:$A$10,ROUNDDOWN(RAND()*9,0)+1),"")
 
Upvote 0
Sorry, there was a mistake in my post.

Try this . . .

=IF((ROW()+1)<=$B$1,INDEX($A$2:$A$10,ROUNDDOWN(RAND()*9,0)+1),"")
Hi Gerald Higgins, this formula worked great, only noticed it was not generating combinations as per B1 value (2 minus then B1 value) I made small change +1 changed to -1 </SPAN></SPAN>

=IF((ROW()
-1)<=$B$1,INDEX($A$2:$A$10,ROUNDDOWN(RAND()*9,0)+1),"")</SPAN></SPAN>

Thank you very much for your time and help
</SPAN></SPAN>

Have a nice weekend
</SPAN></SPAN>

Kind Regards,
</SPAN></SPAN>
Kishan
:)</SPAN></SPAN>
 
Last edited:
Upvote 0

Forum statistics

Threads
1,223,227
Messages
6,170,848
Members
452,361
Latest member
d3ad3y3

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top