+ Reply to Thread
Results 1 to 5 of 5

Excel Puzzle - Eliminating Random Numbers in a Diminishing Sequence

  1. #1
    Registered User
    Join Date
    05-09-2011
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    38

    Excel Puzzle - Eliminating Random Numbers in a Diminishing Sequence

    Good Afternoon Everyone,

    I'm trying to figure out how to take advantage of Excel's random (rand) function in order to come up with a formula to solve this puzzle...

    Puzzle: You have 9 pieces of paper, each with a different number on it ranging from 1 to 9. There are no repeat numbers; simply each paper as the either 1, 2, 3, 4, 5, 6, 7, 8, or 9. You randomly select one of the pieces of paper, and record the number in cell A1. You repeat this process in cells A2 through A9. Your sequence of numbers is completely random. How can I mimic this in Excel?

    The formula in cell A1 is easy enough: =RANDBETWEEN(1,9)

    What would I put in cells A2 through A9 so that it eliminates the number(s) that have already been used? I gave up after a few days of trying to figure this out and started building tables to put together a process of elimination, but still haven't quite figured it out. I'm sure there's an easier way. Thanks!

    Note: I do want this to be completely random, so that I can use the F9 key and record various outcomes.
    Last edited by gjohn282; 11-26-2013 at 08:57 PM.

  2. #2
    Forum Expert Moo the Dog's Avatar
    Join Date
    09-28-2012
    Location
    Wisconsin
    MS-Off Ver
    Office 365 (PC & Mac)
    Posts
    1,845

    Re: Excel Puzzle - Eliminating Random Numbers in a Diminishing Sequence

    Put the numbers 1 - 9 in cells A1:A9 (A1=1, A2=2, etc.)
    In B1 to B9 enter the function: =RAND()
    In C1 enter this formula and fill down to C9: =INDEX($A$1:$A$9,RANK(B1,$B$1:$B$9))

    Column C will now have a list of numbers 1 - 9 without duplicates.

    - Moo

    (h/t to Domenic on another Excel help forum, in a post from 2006)

  3. #3
    Forum Contributor
    Join Date
    07-02-2013
    Location
    Stockholm, Sweden
    MS-Off Ver
    Excel 2003 and 2007
    Posts
    197

    Re: Excel Puzzle - Eliminating Random Numbers in a Diminishing Sequence

    Hi, gjohn282

    Put this formula i cell A2:

    =SMALL(IF(COUNTIF(A$1:A1,ROW($1:$10))<>1,ROW($1:$10)),1+INT(RAND()*(9-ROW()+ROW(A$1))))

    Confirm formula with Ctrl+Shift+Enter (not just Enter)

    Then the formula show:

    {=SMALL(IF(COUNTIF(A$1:A1,ROW($1:$10))<>1,ROW($1:$10)),1+INT(RAND()*(9-ROW()+ROW(A$1))))}

    Copy the formula down to cell A10

  4. #4
    Registered User
    Join Date
    05-09-2011
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    38

    Re: Excel Puzzle - Eliminating Random Numbers in a Diminishing Sequence

    Wow, both are excellent methods. Thank you for the replies!

  5. #5
    Forum Expert Moo the Dog's Avatar
    Join Date
    09-28-2012
    Location
    Wisconsin
    MS-Off Ver
    Office 365 (PC & Mac)
    Posts
    1,845

    Re: Excel Puzzle - Eliminating Random Numbers in a Diminishing Sequence

    Glad to help, and thanks for the Rep. It's always appreciated!

    Happy Thanksgiving!

    - Moo

+ 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. [SOLVED] Random numbers but 3 numbers in sequence not allowed.
    By NewGen in forum Excel Programming / VBA / Macros
    Replies: 18
    Last Post: 07-31-2012, 07:51 AM
  2. Generate random sequence of numbers in excel
    By excelvb in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 04-06-2011, 06:41 AM
  3. [SOLVED] Non-random numbers generated by excel's data analysis random gener
    By Allie in forum Excel Formulas & Functions
    Replies: 10
    Last Post: 09-17-2005, 02:05 AM
  4. Replies: 2
    Last Post: 09-13-2005, 12:05 PM
  5. [SOLVED] GENERATE RANDOM NUMBERS BUT EXCLUDE A NUMBER IN THE SEQUENCE
    By Tracker in forum Excel General
    Replies: 6
    Last Post: 08-04-2005, 10:05 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