random choose numbers

iaudio1233

Board Regular
Joined
Mar 7, 2014
Messages
158
Hi,
there are 12 numbers from 1 to 12
there are 12 cells

requirement : choose 1 number from 1 to 12 and not appear again in any of the other 11 cells

eg.

a1 8
a2 12
a3 7
a4 5
a5 3
a6 11
a7 2
a8 9
a9 8
a10 1
a11 5
a12 4

kindly advise what function should be used ?

thanks
 

Excel Facts

What do {} around a formula in the formula bar mean?
{Formula} means the formula was entered using Ctrl+Shift+Enter signifying an old-style array formula.
Given in A1: =RANDBETWEEN(1,12)
In A2: =SMALL(IF(ISNA(MATCH(ROW(INDIRECT("1:12")),$A$1:A1,0)),ROW(INDIRECT("1:12")),0),RANDBETWEEN(ROWS($A$1:A1)+1,12)) Ctrl + Shift + Enter not just enter on a PC or Command + Return on a MAC
copied down till A12.

Would that work for you?
 
Upvote 0
Another variation:
In Cell A2
Code:
=LARGE(ROW($1:$12)*NOT(COUNTIF($A$1:A1, ROW($1:$12))), RANDBETWEEN(1,12-ROW(A1)+1))

Also entered using CONTROL+SHIFT+ENTER as an array formula. Copied down to A13

Dan
 
Upvote 0
Given in A1: =RANDBETWEEN(1,12)
In A2: =SMALL(IF(ISNA(MATCH(ROW(INDIRECT("1:12")),$A$1:A1,0)),ROW(INDIRECT("1:12")),0),RANDBETWEEN(ROWS($A$1:A1)+1,12)) Ctrl + Shift + Enter not just enter on a PC or Command + Return on a MAC
copied down till A12.

Would that work for you?
It gives me repeated numbers
 
Upvote 0
Hi, all ,

thanks your prompt response.
Cyrilbrd's formula works exactly what I required.
Not yet tried another .
each cell is unique from 1 to 12.
GREAT !!!
 
Upvote 0
Hi, all ,

thanks your prompt response.
Cyrilbrd's formula works exactly what I required.
Not yet tried another .
each cell is unique from 1 to 12.
GREAT !!!
Most welcome, and thank you for the feedback.
 
Upvote 0
sorry gives unique instances for the range A1 to A12 here.
Sorry Dear
I put your formula in column B and 2nd formula in column A
and didn't change A range to B
so it gives me errors
but now it's very nice
thanks
 
Upvote 0
Sorry Dear
I put your formula in column B and 2nd formula in column A
and didn't change A range to B
so it gives me errors
but now it's very nice
thanks

No worries, glad you got it sorted out.
 
Upvote 0

Forum statistics

Threads
1,214,585
Messages
6,120,397
Members
448,957
Latest member
Hat4Life

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