Non-Repeating Randomization

aej

New Member
Joined
Apr 15, 2021
Messages
4
Office Version
  1. 2019
Platform
  1. MacOS
Hello! I was wondering if there is a way to generate multiple columns of random numbers that may repeat within the column, but not within the row. Eg: 3 columns x 80 rows, using the numbers 1-9, where "1,7,7" would not be an acceptable row. It would also be helpful if I could tell Excel to include one number from 1-3 and 2 numbers from 6-9 per row. I know the basics of generating random numbers and non-repeating columns, but wasn't sure about how to automate creating this sort of matrix.
 

Excel Facts

Move date out one month or year
Use =EDATE(A2,1) for one month later. Use EDATE(A2,12) for one year later.
Hi,​
as you forgot to indicate what kind of solution you are expecting for …​
 
Upvote 0
Hi,​
as you forgot to indicate what kind of solution you are expecting for …​
I'm not sure what you mean? I'd like to know if there's certain formula syntax or other techniques that I can use, or if I'm stuck doing it by hand.
 
Upvote 0
As an example, I'd like to be able to make something like this
 

Attachments

  • Screen Shot 2021-04-15 at 11.34.42 AM.png
    Screen Shot 2021-04-15 at 11.34.42 AM.png
    32.6 KB · Views: 15
Upvote 0
For a formula way let's wait for the Excel experts ! I may be back in case of any VBA way …​
 
Upvote 0
For three unique digits from 1-9:

Book1
ABC
1#1#2#3
2364
3276
4562
Sheet1
Cell Formulas
RangeFormula
A2:A4A2=RANDBETWEEN(1,9)
B2:C4B2=LARGE(IF(COUNTIF($A2:A2,{1;2;3;4;5;6;7;8;9})=0,{1;2;3;4;5;6;7;8;9}),RANDBETWEEN(1,10-COLUMN()))
 
Upvote 0
Solution
For three unique digits from 1-9:

Book1
ABC
1#1#2#3
2364
3276
4562
Sheet1
Cell Formulas
RangeFormula
A2:A4A2=RANDBETWEEN(1,9)
B2:C4B2=LARGE(IF(COUNTIF($A2:A2,{1;2;3;4;5;6;7;8;9})=0,{1;2;3;4;5;6;7;8;9}),RANDBETWEEN(1,10-COLUMN()))
Thanks so much!
 
Upvote 0
For three unique digits from 1-9:

Book1
ABC
1#1#2#3
2364
3276
4562
Sheet1
Cell Formulas
RangeFormula
A2:A4A2=RANDBETWEEN(1,9)
B2:C4B2=LARGE(IF(COUNTIF($A2:A2,{1;2;3;4;5;6;7;8;9})=0,{1;2;3;4;5;6;7;8;9}),RANDBETWEEN(1,10-COLUMN()))

Can you help walk me through the formula and how it works.
 
Upvote 0

Forum statistics

Threads
1,214,644
Messages
6,120,709
Members
448,983
Latest member
Joaquim_Baptista

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