+ Reply to Thread
Results 1 to 8 of 8

Pick random 4 cells

  1. #1
    Forum Contributor
    Join Date
    08-27-2014
    Location
    Canada
    MS-Off Ver
    Office 365
    Posts
    100

    Pick random 4 cells

    I am trying to pick 4 cells from the row of cells. For example if I have column A1 (1000 rows) how would I randomly pick 4 of these cells.

    Thanks

  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 2406
    Posts
    44,662

    Re: Pick random 4 cells

    It's not entirely clear what you want... but try this aray formula in C1

    ="A"&LARGE(ROW($1:$1000)*NOT(COUNTIF($c$1:c1, ROW($1:$1000))), RANDBETWEEN(1,1001-ROW(A1)))

    drag down for four rows.

    Array Formulae are a little different from ordinary formulae in that they MUST be confirmed in the FIRST CELL ONLY by pressing CTRL+SHIFT+ENTER to activate the array, not just ENTER. After that, the array can be dragged down as normal, to cover the desired range.

    You will know the array is active when you see curly brackets { } - or "curly braces" for those of you in the USA, or "flower brackets" for those of you in India - appear around the outside of your formula. If you do not use CTRL+SHIFT+ENTER you will (almost always) get an error message or an incorrect answer. Press F2 on that cell and try again.

    Don't type the curly brackets yourself - it won't work...
    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

  3. #3
    Forum Contributor
    Join Date
    08-27-2014
    Location
    Canada
    MS-Off Ver
    Office 365
    Posts
    100

    Re: Pick random 4 cells

    I have column of id's and I am trying to randomly pick 4 of these id's to win the prize

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

    Re: Pick random 4 cells

    =INDEX($A$1:$A$1000,LARGE(ROW($1:$1000)*NOT(COUNTIF($C$1:C1, ROW($1:$1000))), RANDBETWEEN(1,1001-ROW(A1))))

    Bear in mind that the selected values will change when anything else changes on the sheet. If you want to keep th numbers, copy/paste values. Or... you will require VBA
    Attached Files Attached Files

  5. #5
    Forum Contributor
    Join Date
    08-27-2014
    Location
    Canada
    MS-Off Ver
    Office 365
    Posts
    100

    Re: Pick random 4 cells

    ok Thank you

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

    Re: Pick random 4 cells

    Alternatively:

    Please Login or Register  to view this content.
    How to install your new code
    Copy the Excel VBA code
    Select the workbook in which you want to store the Excel VBA code
    Press Alt+F11 to open the Visual Basic Editor
    Choose Insert > Module
    Edit > Paste the macro into the module that appeared
    Close the VBEditor
    Save your workbook (Excel 2007+ select a macro-enabled file format, like *.xlsm)
    [B][I]


    Select 4 cells Paste this into the formula bar and commit with CTRl-Shift-Enter. this is non-volatile. and will not recalculate. Enable macros on opening
    Attached Files Attached Files

  7. #7
    Forum Contributor
    Join Date
    08-27-2014
    Location
    Canada
    MS-Off Ver
    Office 365
    Posts
    100

    Re: Pick random 4 cells

    How would I do this formula if i have only 350 rows?

    Never mind this question. Sorry )
    Last edited by stribor40; 11-24-2017 at 09:36 AM.

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

    Re: Pick random 4 cells

    I assume that you are now OK with the answer. If so, You're welcome.



    If that takes care of your original question, please select "Thread Tools" from the menu link above and mark this thread as SOLVED.

    It'd also be appreciated if you were to click the Add Reputation button at the foot of any of the posts of all members who helped you reach a solution.

+ 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. uner what creteria random formulae pick up next random value?
    By roofi in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 01-16-2014, 12:55 AM
  2. Replies: 1
    Last Post: 08-23-2013, 10:32 AM
  3. [SOLVED] Pick Random Value from a Range (not including empty Cells)
    By ghoneim in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 08-22-2013, 04:46 AM
  4. [SOLVED] Random Pick 4 column of datab but keep 2 cells tied together.
    By Thupp in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 08-17-2013, 06:11 AM
  5. Replies: 8
    Last Post: 08-14-2009, 11:22 AM
  6. Trying to have excel pick random choices from specific cells.
    By Irishjames in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 07-10-2009, 08:10 PM
  7. pick random cells ?
    By fiur in forum Excel General
    Replies: 5
    Last Post: 11-02-2008, 12:22 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