+ Reply to Thread
Results 1 to 4 of 4

macro to put numbers in random order

  1. #1
    Forum Contributor
    Join Date
    05-04-2015
    Location
    Atlanta GA
    MS-Off Ver
    2010
    Posts
    106

    macro to put numbers in random order

    I need a macro that will put a column of 40 numbers in random order

    1
    2
    3
    4
    5
    6

    to

    3
    6
    1
    3
    5
    4

  2. #2
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,025

    Re: macro to put numbers in random order

    One (non-macro) approach would be to use

    =RAND() in column B, copy and paste values, and then:

    EITHER: sort columns A & B using the values in column B.

    OR use this formula in C1, copied down:
    =INDEX($A$1:$A$40,MATCH(SMALL($B$1:$B$40,ROWS($C$1:C1)),$B$1:$B$40,0))
    Glenn




    None of us get paid for helping you... we do this for fun. So DON'T FORGET to say "Thank You" to all who have freely given some of their time to help YOU.

    Temporary addition of accented to illustrate ongoing problem to the TT: L? fh?ile P?draig sona dhaoibh

  3. #3
    Forum Expert
    Join Date
    03-23-2004
    Location
    London, England
    MS-Off Ver
    Excel 2019
    Posts
    7,064

    Re: macro to put numbers in random order

    You're implying no repeats, but you haven't stated that.

    Does it have to be a macro?
    If not try this

    Put your 40 numbers in A1:A40
    in B1:B40 put =RAND()
    in C1:C40 put =INDEX(A$1:A$40,MATCH(SMALL(B$1:B$40,ROW()),B$1:B$40,0))

    Your output is in column C. 40 non-repeated random numbers.

    UPDATE: Damn! 1 minute late :-(
    Regards
    Special-K

    Ensure you describe your problem clearly, I have little time available to solve these problems and do not appreciate numerous changes to them.

  4. #4
    Forum Contributor
    Join Date
    05-04-2015
    Location
    Atlanta GA
    MS-Off Ver
    2010
    Posts
    106

    Re: macro to put numbers in random order

    Thanks guys!!! Exactly what I need!!

+ 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] Copy and paste from random order to alpha-numeric order
    By OthelloDog in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 02-03-2016, 11:11 PM
  2. [SOLVED] Macro to pull 6 random numbers from a list of numbers.
    By Shellybelly in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 08-31-2014, 07:07 AM
  3. Random numbers without a macro?
    By cat3rn in forum Excel Formulas & Functions
    Replies: 12
    Last Post: 02-05-2014, 04:10 PM
  4. Replies: 4
    Last Post: 10-14-2013, 10:15 AM
  5. putting random numbers in order
    By okg in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 06-03-2011, 04:07 PM
  6. random order numbers
    By zugfrig1978 in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 09-17-2008, 02:02 AM
  7. Can I create a random order within a series of numbers in Excel?
    By Dimtrax in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 11-09-2005, 11:45 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