+ Reply to Thread
Results 1 to 12 of 12

randbetween function - no duplicates in specific area?

  1. #1
    Registered User
    Join Date
    10-27-2017
    Location
    Illinois
    MS-Off Ver
    2013
    Posts
    12

    randbetween function - no duplicates in specific area?

    I'm trying to generate 100x bingo cards. I have 75 total "numbers" and each card is 5x5. Currently to generate each individual cell I'm doing the below formula, so this exists in all 2500 cells across the 100 cards;

    =CHOOSE(RANDBETWEEN(1,75),Conditions!$A$2,Conditions!$A$3,Conditions!$A$4,Conditions!$A$5,Conditions!$A$6,Conditions!$A$7,Conditions!$A$8,Conditions!$A$9,Conditions!$A$10,Conditions!$A$11,Conditions!$A$12,Conditions!$A$13,Conditions!$A$14,Conditions!$A$15,Conditions!$A$16,Conditions!$A$17,Conditions!$A$18,Conditions!$A$19,Conditions!$A$20,Conditions!$A$21,Conditions!$A$22,Conditions!$A$23,Conditions!$A$24,Conditions!$A$25,Conditions!$A$26,Conditions!$A$27,Conditions!$A$28,Conditions!$A$29,Conditions!$A$30,Conditions!$A$31,Conditions!$A$32,Conditions!$A$33,Conditions!$A$34,Conditions!$A$35,Conditions!$A$36,Conditions!$A$37,Conditions!$A$38,Conditions!$A$39,Conditions!$A$40,Conditions!$A$41,Conditions!$A$42,Conditions!$A$43,Conditions!$A$44,Conditions!$A$45,Conditions!$A$46,Conditions!$A$47,Conditions!$A$48,Conditions!$A$49,Conditions!$A$50,Conditions!$A$51,Conditions!$A$52,Conditions!$A$53,Conditions!$A$54,Conditions!$A$55,Conditions!$A$56,Conditions!$A$57,Conditions!$A$58,Conditions!$A$59,Conditions!$A$60,Conditions!$A$61,Conditions!$A$62,Conditions!$A$63,Conditions!$A$64,Conditions!$A$65,Conditions!$A$66,Conditions!$A$67,Conditions!$A$68,Conditions!$A$69,Conditions!$A$70,Conditions!$A$71,Conditions!$A$72,Conditions!$A$73,Conditions!$A$74,Conditions!$A$75,Conditions!$A$76)

    My issue is that sometimes a card has multiple instances of the same number as duplicates are not being weeded out. I need every value within a single 5x5 card to be unique I'm trying to avoid the attached example from happening.

    I'm not trying to do a strict bingo card where the first column is 1-15, etc, as the numbers will be replaced with words eventually.

    Alternatively if there is a way easier way to be doing this, that's be great, too :D!

    Thanks!
    Attached Images Attached Images
    Last edited by SineNomine; 08-09-2020 at 01:20 PM.

  2. #2
    Forum Guru
    Join Date
    04-23-2012
    Location
    New Jersey, USA
    MS-Off Ver
    Excel 365
    Posts
    2,475

    Re: randbetween function - no duplicates in specific area?

    You call it a "Bingo Card" but all the Bingo Cards I am familiar with restrict what numbers can be in each column. For example, the first column which is always(?) title "B" can only have the numbers 1 through 15... each succeeding column can only have the next set of 15 numbers until the "O" column is reached which can only have the numbers 60 through 75 in it. Are you saying your Bingo Cards do not follow this rule... that any of the 75 numbers can be in any column so long as no number duplicates?

  3. #3
    Registered User
    Join Date
    10-27-2017
    Location
    Illinois
    MS-Off Ver
    2013
    Posts
    12

    Re: randbetween function - no duplicates in specific area?

    Quote Originally Posted by Rick Rothstein View Post
    You call it a "Bingo Card" but all the Bingo Cards I am familiar with restrict what numbers can be in each column. For example, the first column which is always(?) title "B" can only have the numbers 1 through 15... each succeeding column can only have the next set of 15 numbers until the "O" column is reached which can only have the numbers 60 through 75 in it. Are you saying your Bingo Cards do not follow this rule... that any of the 75 numbers can be in any column so long as no number duplicates?
    my intention is to not have them follow the standard 1-15 16-30 31-45 etc etc rules of standard bingo. If that makes this way more difficult, I suppose I could live with the standard sequences.

  4. #4
    Forum Guru
    Join Date
    04-23-2012
    Location
    New Jersey, USA
    MS-Off Ver
    Excel 365
    Posts
    2,475

    Re: randbetween function - no duplicates in specific area?

    I was just checking that you actually wanted what you appeared to be asking for. Okay, with that said, I cannot think of a way to do what you want with formulas. I do have a way to do it with a VBA macro, would you by any chance be open to such a solution? If not, maybe someone else more knowledgeable in formulas than I am will come along and provide you with a formula solution.

  5. #5
    Registered User
    Join Date
    10-27-2017
    Location
    Illinois
    MS-Off Ver
    2013
    Posts
    12

    Re: randbetween function - no duplicates in specific area?

    I'm open to it though my VBA knowledge is pretty much copy/pasting someone else's macro in and pressing run

  6. #6
    Forum Guru
    Join Date
    04-13-2005
    Location
    North America
    MS-Off Ver
    2002/XP, 2007, 2024
    Posts
    16,454

    Re: randbetween function - no duplicates in specific area?

    Here's how I would do it (formulas only, no VBA). I'm assuming you are wanting to select 25 random numbers between 1 and 75 without repeats. I generally prefer a "shuffle" algorithm rather than a random number generator algorithm.

    1) Generate 75 unique random numbers. Maybe put =RAND() into A1 and copy/paste/fill into A1:E15 (a 2D grid to match the 2D grid of the bingo card).
    2) Rank the first 5x5=25 random numbers in the block =RANK(A1,$A$1:$E$15) into G1. Copy/paste/fill into G1:K5.
    3) G1 to K5 is now your bingo card. Make 100 copies of this tab to get 100 bingo cards. (this is a little tedious to do manually, but should not take too long.)

    Like or dislike?

    Edit to add: remember that RAND() is volatile, so you will get new bingo cards with every calculate event.
    Quote Originally Posted by shg
    Mathematics is the native language of the natural world. Just trying to become literate.

  7. #7
    Forum Guru
    Join Date
    04-23-2012
    Location
    New Jersey, USA
    MS-Off Ver
    Excel 365
    Posts
    2,475

    Re: randbetween function - no duplicates in specific area?

    Quote Originally Posted by SineNomine View Post
    I'm open to it though my VBA knowledge is pretty much copy/pasting someone else's macro in and pressing run
    Here is a macro along with a function that the macro calls in order to randomize the array for each Bingo Card outputted.
    Please Login or Register  to view this content.
    HOW TO INSTALL MACROs
    ------------------------------------
    If you are new to macros, they are easy to install and use. To install it, simply press ALT+F11 to go into the VB editor and, once there, click Insert/Module on its menu bar, then copy/paste all of the above code (both the macro and function) into the code window that just opened up. That's it.... you are done. To use the macro, go back to the worksheet with your data on it and press ALT+F8, select the macro name (Bingo) from the list that appears and click the Run button. The macro will execute and perform the action(s) you asked for. If you will need to do this again in this same workbook, and if you are using XL2007 or above, make sure you save your file as an "Excel Macro-Enabled Workbook (*.xlsm) and answer the "do you want to enable macros" question as "yes" or "OK" (depending on the button label for your version of Excel) the next time you open your workbook.

  8. #8
    Forum Expert bebo021999's Avatar
    Join Date
    07-22-2011
    Location
    Vietnam
    MS-Off Ver
    Excel 2016
    Posts
    9,659

    Re: randbetween function - no duplicates in specific area?

    Here my approach:
    1) Generate unique random list of 75
    2) Card #1 get first 25 (cell 1 to 25 get 1 to 25 in order), similar to Card #2 (26 to 50), #3 (51 to 75)
    I believe that each value in each set of 25 is REAL unique random
    And the 3 cards are unique.
    3) Print out or store value of first 3 cards
    4) Hit F9 to generate a new random of 3-cards set
    Attached Files Attached Files
    Quang PT

  9. #9
    Forum Guru Bo_Ry's Avatar
    Join Date
    09-10-2018
    Location
    Thailand
    MS-Off Ver
    MS 365
    Posts
    7,222

    Re: randbetween function - no duplicates in specific area?

    Please see this clip
    https://www.youtube.com/watch?v=LYEX0K7i_0k

    B2:F6
    =RANK(B9,B$9:B$23)+15*(COLUMNS($B2:B2)-1)

    B9:F23
    =RAND()

  10. #10
    Registered User
    Join Date
    10-27-2017
    Location
    Illinois
    MS-Off Ver
    2013
    Posts
    12

    Re: randbetween function - no duplicates in specific area?

    Thank you this worked well!

  11. #11
    Forum Guru
    Join Date
    04-23-2012
    Location
    New Jersey, USA
    MS-Off Ver
    Excel 365
    Posts
    2,475

    Re: randbetween function - no duplicates in specific area?

    Just so we and future readers of this thread know what worked well, who was your comment directed at (my guess is Bo_Ry's, but you should make it clear)?

  12. #12
    Registered User
    Join Date
    10-27-2017
    Location
    Illinois
    MS-Off Ver
    2013
    Posts
    12

    Re: randbetween function - no duplicates in specific area?

    oh, in the end as I'm actually using words instead of numbers the VBA worked the best for me as I was able to just find and replace the numbers with the words I was using, though all solutions seemed like they'd work if I were purely using numbers

+ 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. RandBetween - No Duplicates in Column
    By stewarttracy in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-11-2018, 04:36 PM
  2. [SOLVED] Randbetween with No Duplicates
    By novice1239 in forum Excel General
    Replies: 6
    Last Post: 03-19-2017, 10:17 AM
  3. [SOLVED] Need help to move duplicates from a list and paste them in a specific area on worksheet
    By Shellybelly in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 05-13-2015, 08:21 PM
  4. [SOLVED] How do you avoid duplicates when using the randbetween function?
    By Monica in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 09-28-2014, 02:07 AM
  5. Randbetween without duplicates
    By Williamdry in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 07-29-2014, 09:27 AM
  6. [SOLVED] =RANDBETWEEN Function for growing price list with no duplicates...
    By unclejemima in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 05-18-2013, 03:29 PM
  7. making a specific RANDBETWEEN function
    By cowboy713 in forum Excel General
    Replies: 4
    Last Post: 11-05-2010, 04:41 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