Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
Roy Roy is offline
external usenet poster
 
Posts: 53
Default Nine random and unlike numbers

Hi,

How can I generate 9 diffrent numbers from 1 to 9 thats not repeat it's self.
I need the number 1 - 9 in random order.

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Nine random and unlike numbers


You can do it this way

put this formula in A1

=RAND()
and copy down to A9

in B1 use this formula

=RANK(A1,A$1:A$9)
copy down to B9

B1:B9 should now show 1-9 in random order, hide column A if desired.

Note: values will change every time sheet recalculates


--
daddylonglegs
------------------------------------------------------------------------
daddylonglegs's Profile: http://www.excelforum.com/member.php...o&userid=30486
View this thread: http://www.excelforum.com/showthread...hreadid=506159

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 17
Default Nine random and unlike numbers

Try this it works but some on here may think its a bit poor?

Sub randNumber()

Range("A1").Value = Int((9 * Rnd) + 1)

For i = 1 To 8
rng = "A" & i
Redo:
Range("A1").Offset(i, 0).Value = Int((9 * Rnd) + 1)
For n = 0 To i - 1 Step 1
If Range("A1").Offset(i, 0).Value = Range("A1").Offset(n, 0) Then
n = n - 1
GoTo Redo
End If
Next n

Next i
End Sub

This puts a random number in cell A1 then starts a loop from A2 which first
starts by entering the next random number in A2 using offset then checks it
against A1 if it matches it enters another rand number until it finds one
that does not match. And then so on in the loop with the next cell.

Regards
Neil
"daddylonglegs"
wrote in message
news:daddylonglegs.22emnm_1138551900.9949@excelfor um-nospam.com...

You can do it this way

put this formula in A1

=RAND()
and copy down to A9

in B1 use this formula

=RANK(A1,A$1:A$9)
copy down to B9

B1:B9 should now show 1-9 in random order, hide column A if desired.

Note: values will change every time sheet recalculates


--
daddylonglegs
------------------------------------------------------------------------
daddylonglegs's Profile:
http://www.excelforum.com/member.php...o&userid=30486
View this thread: http://www.excelforum.com/showthread...hreadid=506159





  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,624
Default Nine random and unlike numbers

For one way, see

http://www.mcgimpsey.com/excel/udfs/randint.html

In article ,
Roy wrote:

Hi,

How can I generate 9 diffrent numbers from 1 to 9 thats not repeat it's self.
I need the number 1 - 9 in random order.

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 17
Default Nine random and unlike numbers

Try this it works but some on here may think its a bit poor?

Sub randNumber()

Range("A1").Value = Int((9 * Rnd) + 1)

For i = 1 To 8
rng = "A" & i
Redo:
Range("A1").Offset(i, 0).Value = Int((9 * Rnd) + 1)
For n = 0 To i - 1 Step 1
If Range("A1").Offset(i, 0).Value = Range("A1").Offset(n, 0) Then
n = n - 1
GoTo Redo
End If
Next n

Next i
End Sub

This puts a random number in cell A1 then starts a loop from A2 which first
starts by entering the next random number in A2 using offset then checks it
against A1 if it matches it enters another rand number until it finds one
that does not match. And then so on in the loop with the next cell.

Regards
Neil
"Roy" wrote in message
...
Hi,

How can I generate 9 diffrent numbers from 1 to 9 thats not repeat it's
self.
I need the number 1 - 9 in random order.






Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
getting numbers divisible by 4 from random numbers in ascending order ramana Excel Worksheet Functions 6 June 19th 07 06:41 PM
merge unlike & like data in excel Valerie Excel Worksheet Functions 1 July 1st 06 11:20 AM
Overtime Question Unlike Others (Pictures Included) C A Excel Worksheet Functions 2 October 28th 05 04:48 PM
Non-random numbers generated by excel's data analysis random gener Allie Excel Worksheet Functions 10 September 17th 05 06:19 AM
Non-random numbers generated by excel's data analysis random gener Harlan Grove Excel Discussion (Misc queries) 2 September 13th 05 04:06 PM


All times are GMT +1. The time now is 08:25 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"