+ Reply to Thread
Results 1 to 4 of 4

repeating number list without duplication

  1. #1
    Registered User
    Join Date
    02-23-2021
    Location
    UK
    MS-Off Ver
    2016
    Posts
    49

    repeating number list without duplication

    How can I extend this code to generate a random list of numbers between 1 - 7 as many times as I define. For example if I was 3 sets of random numbers between 1 - 7 but without duplications in the first set and then in second set and then in the third set of 1 - 7s ?
    eg list would read 1,2,3,4,5,6,7,1,2,3,4,5,6,7,1,2,3,4,5,6,7 but obviously the list would be random without duplication in each 1-7 set.

    Also is there anyway to right this as a function?

    Thanks

    Please Login or Register  to view this content.

  2. #2
    Valued Forum Contributor rollis13's Avatar
    Join Date
    01-26-2012
    Location
    Cordenons
    MS-Off Ver
    Excel 2016 32bit - Win 11
    Posts
    935

    Re: repeating number list without duplication

    Maybe:
    Please Login or Register  to view this content.
    Difficult is not to know but to share what you know (Han Fei Tzu reworked)

  3. #3
    Forum Expert
    Join Date
    11-24-2013
    Location
    Paris, France
    MS-Off Ver
    Excel 2003 / 2010
    Posts
    9,831

    Cool Try this ...


    A classic Excel basics VBA demonstration for starters :

    PHP Code: 
    Sub Demo1()
      Const 
    37
            Columns
    (7).Clear
        
    For N% = 1 To C
            With Cells
    (* (1), 7).Resize(R)
                .
    Formula "=RAND()"
                
    .Value Application.Rank(.Cells, .Cells)
            
    End With
        Next
    End Sub 
    ► Do you like it ? ► So thanks to click on bottom left star icon « Add Reputation » !
    Last edited by Marc L; 12-15-2023 at 09:08 PM.

  4. #4
    Forum Expert
    Join Date
    12-10-2006
    Location
    Sydney
    MS-Off Ver
    Office 365
    Posts
    3,565

    Re: repeating number list without duplication

    Hi Nightowel23,

    Put the numbers 1 to 7 into the range A2:A8, enter 3 in cell B2, ensure the ws variable is set correctly and then try this where it outputs the number of permutations that equal what's in cell B2:

    Please Login or Register  to view this content.
    Regards,

    Robert
    Last edited by Trebor76; 12-15-2023 at 11:10 PM.
    ____________________________________________
    Please ensure you mark your thread as Solved once it is. Click here to see how
    If this post helps, please don't forget to say thanks by clicking the star icon in the bottom left-hand corner of my post

+ 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. The sum of a column between the same repeating text string
    By thomasgladwell in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 04-10-2019, 09:13 AM
  2. Replies: 12
    Last Post: 04-08-2019, 08:55 AM
  3. Replies: 2
    Last Post: 01-05-2018, 12:31 AM
  4. Repeating specific dates in date string
    By greggatz in forum Excel Formulas & Functions
    Replies: 12
    Last Post: 01-25-2017, 04:00 AM
  5. [SOLVED] Repeating a Text String a Fixed Number of Times
    By andrewc in forum Excel General
    Replies: 2
    Last Post: 10-21-2013, 09:51 AM
  6. Replies: 1
    Last Post: 11-04-2012, 07:51 AM
  7. Finding repeating multiple characters from a string in cell
    By varg111 in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 10-16-2012, 08:15 AM

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