using random between formular part 2

tonylpcs@yahoo.co.uk

Active Member
Joined
Dec 19, 2007
Messages
379
Hi Everyone,

i have a spreedsheet and need to be able to generate 20 randon numbers between 1 and 20 in cell D5 down to cells D24 but with each cell having a different number in it.

Ive had lots of help and have got very close but no cigar so far,

can someone please help me as to how i can do this?

bellow is the formula that has come closest so far but it wont generate 20 randon numbers for some reason it needs more numbers than i want to give it?

basicly i put a value in cell C3 (i.e 1) and a max value in e3 (i.e 20)

i have then put the following formulars is cell D5 down to D24

Code:
=LARGE(ROW(INDIRECT($C$3&":"&$E$3))*NOT(COUNTIF(D$4:D4, ROW(INDIRECT($C$3&":"&$E$3)))), RANDBETWEEN(1,$E$3-$C$3-ROW(D6:D25)))
=LARGE(ROW(INDIRECT($C$3&":"&$E$3))*NOT(COUNTIF(D$4:D5, ROW(INDIRECT($C$3&":"&$E$3)))), RANDBETWEEN(1,$E$3-$C$3-ROW(D7:D25)))
=LARGE(ROW(INDIRECT($C$3&":"&$E$3))*NOT(COUNTIF(D$4:D6, ROW(INDIRECT($C$3&":"&$E$3)))), RANDBETWEEN(1,$E$3-$C$3-ROW(D8:D25)))
=LARGE(ROW(INDIRECT($C$3&":"&$E$3))*NOT(COUNTIF(D$4:D7, ROW(INDIRECT($C$3&":"&$E$3)))), RANDBETWEEN(1,$E$3-$C$3-ROW(D9:D25)))
=LARGE(ROW(INDIRECT($C$3&":"&$E$3))*NOT(COUNTIF(D$4:D8, ROW(INDIRECT($C$3&":"&$E$3)))), RANDBETWEEN(1,$E$3-$C$3-ROW(D10:D25)))
=LARGE(ROW(INDIRECT($C$3&":"&$E$3))*NOT(COUNTIF(D$4:D9, ROW(INDIRECT($C$3&":"&$E$3)))), RANDBETWEEN(1,$E$3-$C$3-ROW(D11:D25)))
=LARGE(ROW(INDIRECT($C$3&":"&$E$3))*NOT(COUNTIF(D$4:D10, ROW(INDIRECT($C$3&":"&$E$3)))), RANDBETWEEN(1,$E$3-$C$3-ROW(D12:D25)))
=LARGE(ROW(INDIRECT($C$3&":"&$E$3))*NOT(COUNTIF(D$4:D11, ROW(INDIRECT($C$3&":"&$E$3)))), RANDBETWEEN(1,$E$3-$C$3-ROW(D13:D25)))
=LARGE(ROW(INDIRECT($C$3&":"&$E$3))*NOT(COUNTIF(D$4:D12, ROW(INDIRECT($C$3&":"&$E$3)))), RANDBETWEEN(1,$E$3-$C$3-ROW(D14:D25)))
=LARGE(ROW(INDIRECT($C$3&":"&$E$3))*NOT(COUNTIF(D$4:D13, ROW(INDIRECT($C$3&":"&$E$3)))), RANDBETWEEN(1,$E$3-$C$3-ROW(D15:D25)))
=LARGE(ROW(INDIRECT($C$3&":"&$E$3))*NOT(COUNTIF(D$4:D14, ROW(INDIRECT($C$3&":"&$E$3)))), RANDBETWEEN(1,$E$3-$C$3-ROW(D16:D25)))
=LARGE(ROW(INDIRECT($C$3&":"&$E$3))*NOT(COUNTIF(D$4:D15, ROW(INDIRECT($C$3&":"&$E$3)))), RANDBETWEEN(1,$E$3-$C$3-ROW(D17:D25)))
=LARGE(ROW(INDIRECT($C$3&":"&$E$3))*NOT(COUNTIF(D$4:D16, ROW(INDIRECT($C$3&":"&$E$3)))), RANDBETWEEN(1,$E$3-$C$3-ROW(D18:D25)))
=LARGE(ROW(INDIRECT($C$3&":"&$E$3))*NOT(COUNTIF(D$4:D17, ROW(INDIRECT($C$3&":"&$E$3)))), RANDBETWEEN(1,$E$3-$C$3-ROW(D19:D25)))
=LARGE(ROW(INDIRECT($C$3&":"&$E$3))*NOT(COUNTIF(D$4:D18, ROW(INDIRECT($C$3&":"&$E$3)))), RANDBETWEEN(1,$E$3-$C$3-ROW(D20:D25)))
=LARGE(ROW(INDIRECT($C$3&":"&$E$3))*NOT(COUNTIF(D$4:D19, ROW(INDIRECT($C$3&":"&$E$3)))), RANDBETWEEN(1,$E$3-$C$3-ROW(D21:D25)))
=LARGE(ROW(INDIRECT($C$3&":"&$E$3))*NOT(COUNTIF(D$4:D20, ROW(INDIRECT($C$3&":"&$E$3)))), RANDBETWEEN(1,$E$3-$C$3-ROW(D22:D25)))
=LARGE(ROW(INDIRECT($C$3&":"&$E$3))*NOT(COUNTIF(D$4:D21, ROW(INDIRECT($C$3&":"&$E$3)))), RANDBETWEEN(1,$E$3-$C$3-ROW(D23:D25)))
=LARGE(ROW(INDIRECT($C$3&":"&$E$3))*NOT(COUNTIF(D$4:D22, ROW(INDIRECT($C$3&":"&$E$3)))), RANDBETWEEN(1,$E$3-$C$3-ROW(D24:D25)))
=LARGE(ROW(INDIRECT($C$3&":"&$E$3))*NOT(COUNTIF(D$4:D23, ROW(INDIRECT($C$3&":"&$E$3)))), RANDBETWEEN(1,$E$3-$C$3-ROW(D25)))


the problem is it requires a higher number than the number of lines so i cant get exactly 1 to 20

can someone please tell me where im going wrong?

thanks

Tony
 

Excel Facts

Lock one reference in a formula
Need 1 part of a formula to always point to the same range? use $ signs: $V$2:$Z$99 will always point to V2:Z99, even after copying
I have a real easy way of doing this. I used it when making card games in VBA. Make two columns. First column will be 20 random numbers =RAND(). The second column will be numbered 1-20. When you "calculate" or f9, the first column will create a bunch of random numbers. Sort both columns by the random numbers, and bam, your second column is in a random order. copy-paste, done.
 
Upvote 0

Forum statistics

Threads
1,224,586
Messages
6,179,707
Members
452,939
Latest member
WCrawford

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