+ Reply to Thread
Results 1 to 3 of 3

Random Name Generator

  1. #1
    Registered User
    Join Date
    01-29-2024
    Location
    Baltimore, Maryland
    MS-Off Ver
    LTSC Professional Plus 2021
    Posts
    1

    Question Random Name Generator

    Hello, I am trying to use a list of 21 names to fill a 7x15 grid by randomly selecting a name 5 times.

    The random formula I am currently using is =INDEX(A16:A36,RANDBETWEEN(1,COUNTA(A16:A36)))

    This is successfully grabbing a random name from my list of names (A16:A36), however I am not sure how to limit it to only selecting it 5 times.

    I could also for simplicity instead of filling the grid, create 21 rows and 5 columns, each column having its own randomized list of 21 names without duplicates and then just move them over to my grid.

    The problem is I cannot get it to either stop at 5 generations (not critical). And I cannot get it to not duplicate (critical).

  2. #2
    Forum Guru
    Join Date
    04-13-2005
    Location
    North America
    MS-Off Ver
    2002/XP and 2007
    Posts
    15,829

    Re: Random Name Generator

    I would probably approach this with a "shuffle and sort" algorithm rather than use RANDBETWEEN() in an INDEX() function.

    1) From your list of 21 names, create a list of 105 entries, where each name appears 5 times.
    2) Assign random unique numbers to each entry in this new list (I tend to use RAND() for this. It's not guaranteed not to repeat, but, IME, it only very rarely repeats). Remember that RAND() is volatile and will recalculate with each calculate event. You may consider something to control when this list of random numbers refreshes.
    3) Sort the list by the random numbers.
    4) Fill the 7x15 grid by reading names from the top to the bottom.

    I've left it to you to fill in the programming details at this point. Do you need help with the programming details for each step?
    Quote Originally Posted by shg
    Mathematics is the native language of the natural world. Just trying to become literate.

  3. #3
    Forum Guru
    Join Date
    09-10-2017
    Location
    Chippenham, England
    MS-Off Ver
    365
    Posts
    15,080

    Re: Random Name Generator

    how about
    Formula: copy to clipboard
    Please Login or Register  to view this content.

+ 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 string generator is not random
    By LordBroker in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 09-21-2023, 10:46 AM
  2. [SOLVED] Random number generator not always generating random numbers
    By Murman01 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 06-03-2021, 05:29 PM
  3. Replies: 6
    Last Post: 02-20-2019, 12:47 AM
  4. Replies: 5
    Last Post: 06-21-2013, 10:40 AM
  5. random generator
    By arn2025 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 04-04-2012, 04:17 AM
  6. VBA Random Generator
    By switm in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-22-2011, 02:22 PM
  7. Random Name Generator
    By Smeeg in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 03-03-2006, 11:30 AM

Tags for this Thread

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