+ Reply to Thread
Results 1 to 4 of 4

Random numbers without repeat in each column and row

  1. #1
    Registered User
    Join Date
    02-18-2016
    Location
    Bulgaria
    MS-Off Ver
    2007
    Posts
    2

    Random numbers without repeat in each column and row

    I need to generate random numbers range between 1 to 8 without repeat. When user generate the numbers again, the numbers should not repeat in same row. 4 columns needed.

    Example:
    2 8 4 7
    4 6 3 1
    3 5 2 6
    7 1 6 2
    1 7 5 8
    6 3 1 5
    5 4 8 3
    8 2 7 4

    I tried with some formulas but I am not very good.

  2. #2
    Forum Expert
    Join Date
    12-14-2012
    Location
    London England
    MS-Off Ver
    MS 365 Office Suite.
    Posts
    8,448

    Re: Random numbers without repeat in each column and row

    I cannot post code.

    will try to share a sample spreadsheet.
    Attached Files Attached Files
    My General Rules if you want my help. Not aimed at any person in particular:

    1. Please Make Requests not demands, none of us get paid here.

    2. Check back on your post regularly. I will not return to a post after 4 days.
    If it is not important to you then it definitely is not important to me.

  3. #3
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,196

    Re: Random numbers without repeat in each column and row

    See attached.

    No code TAGS available

    Sub rnd_martix()

    Dim rndx(8, 8) As Integer
    Dim used(8) As Integer

    For j = 1 To 8
    used(j) = 0
    n = j
    For i = 1 To 8
    rndx(i, j) = n
    n = n + 1
    If n > 8 Then n = 1
    Next i
    Next j

    For i = 1 To 4
    n = WorksheetFunction.RandBetween(1, 8)
    Do Until used(n) = 0
    n = WorksheetFunction.RandBetween(1, 8)
    Loop
    used(n) = 1
    For j = 1 To 8
    Cells(j, i) = rndx(j, n)
    Next j
    Next i
    End Sub
    Attached Files Attached Files

  4. #4
    Registered User
    Join Date
    03-15-2016
    Location
    UAE - RAK
    MS-Off Ver
    2016
    Posts
    1

    Re: Random numbers without repeat in each column and row

    thank you very much

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Random numbers without repeat in each column and row
    By rick9 in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 02-18-2016, 03:08 PM
  2. [SOLVED] Rearranging random numbers in a column into ordered numbers in another row
    By joel.mugabe in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 02-09-2016, 05:02 AM
  3. Return 3 random values from column with equal probability but cannot repeat
    By anxiolydiot in forum Excel Formulas & Functions
    Replies: 11
    Last Post: 10-25-2015, 09:41 PM
  4. Excel 2007 : Repeat random numbers
    By deastham2000 in forum Excel General
    Replies: 2
    Last Post: 11-21-2011, 10:58 AM
  5. Repeat random numbers from a range and text
    By kitkat1 in forum Excel General
    Replies: 5
    Last Post: 07-10-2006, 10:49 AM
  6. Replies: 1
    Last Post: 06-07-2006, 02:25 AM
  7. If I create a random list in Excel, does it repeat numbers?
    By Kelly in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 03-29-2005, 11:06 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1