+ Reply to Thread
Results 1 to 9 of 9

Selecting random cells based on criteria

  1. #1
    Registered User
    Join Date
    10-01-2012
    Location
    Camborne
    MS-Off Ver
    Excel 2010
    Posts
    6

    Selecting random cells based on criteria

    Hi I have a sheet that contains a few thousand entries.

    In column "D" I have a value assigned to each entry (A, - W)

    What I want to do is select a random set of entries for each of the criteria in column "D" and return a list of cell values that are in column "A"

    However the number of cells I want to return changes for each criteria

    So for example If cell in column "D" contains an "A" I want to return the value of the corresponding cell in Column "A".

    So far so good?

    The next twist is that there is a variable number of entries for each criteria (A, B, C, etc... ,W)

    So if there are a total of 56 entries with an "A" in column "D" I want to specify the number of random entries I want returned for example I only want 9 of the 56.

    If that hasn't totally confused everyone, any suggestions on how to do this would be welcome.

  2. #2
    Registered User
    Join Date
    10-07-2015
    Location
    Vancouver, BC, Canada
    MS-Off Ver
    Office 365
    Posts
    22

    Re: Selecting random cells based on criteria

    please attach an example file and explain on that

  3. #3
    Registered User
    Join Date
    10-01-2012
    Location
    Camborne
    MS-Off Ver
    Excel 2010
    Posts
    6

    Re: Selecting random cells based on criteria

    Sorry forgot to include the workbook
    Attached Files Attached Files

  4. #4
    Forum Guru samba_ravi's Avatar
    Join Date
    07-26-2011
    Location
    Hyderabad, India
    MS-Off Ver
    Excel 2021
    Posts
    8,939

    Re: Selecting random cells based on criteria

    How your expected result would be?
    Samba

    Say thanks to those who have helped you by clicking Add Reputation star.

  5. #5
    Registered User
    Join Date
    10-01-2012
    Location
    Camborne
    MS-Off Ver
    Excel 2010
    Posts
    6

    Re: Selecting random cells based on criteria

    Expected results shown in workbook

  6. #6
    Forum Expert newdoverman's Avatar
    Join Date
    02-07-2013
    Location
    Port Dover, Ontario, Canada
    MS-Off Ver
    2010
    Posts
    10,330

    Re: Selecting random cells based on criteria

    Insert a helper column and assign random numbers to the column using RANDBETWEEN
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    Copy this column and Paste Values to eliminate the formulae. My helper column was G
    I entered the letter in D34 and the number required in D35.
    I entered this formula in E34 and filled down:
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    ...confirmed by pressing CTRL+SHIFT+ENTER to activate the array, not just ENTER. You will know the array is active when you see curly braces { } appear around your formula. If you do not CTRL+SHIFT+ENTER you will get an error or a clearly incorrect answer. Press F2 on that cell and try again.
    Attached Files Attached Files
    <---------If you like someone's answer, click the star to the left of one of their posts to give them a reputation point for that answer.
    Ron W

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

    Re: Selecting random cells based on criteria

    Assuming 1st starting at A34.

    In A34:

    Please Login or Register  to view this content.
    ...confirmed by pressing CTRL+SHIFT+ENTER to activate the array, not just ENTER. You will know the array is active when you see curly braces { } appear around your formula. If you do not CTRL+SHIFT+ENTER you will get an error or a clearly incorrect answer. Press F2 on that cell and try again.

    In A35:

    Please Login or Register  to view this content.
    Ctrl-shift-enter

    Copy A35 to A36
    Quang PT

  8. #8
    Registered User
    Join Date
    10-01-2012
    Location
    Camborne
    MS-Off Ver
    Excel 2010
    Posts
    6

    Re: Selecting random cells based on criteria - SOLVED

    Solved in another forum - Selecting random cells based on criteria

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

    Re: Selecting random cells based on criteria

    Quote Originally Posted by JamesTrethowan View Post
    Could you give some comments on my and newdoverman's post? By that way, at least, giving respects to helpers.

+ 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. Selecting random rows based on criteria in other columns
    By Insert Name in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 05-16-2015, 01:35 AM
  2. [SOLVED] Selecting a Random Name ONLY if they meet certain criteria
    By EveyDantes in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 11-14-2014, 01:57 PM
  3. Selecting a vallue from multiple cells based on a set of criteria
    By kelvinong1967 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 08-28-2014, 06:36 AM
  4. Using Avergeifs and selecting last 8 cells based on criteria
    By boyesmar in forum Excel Formulas & Functions
    Replies: 12
    Last Post: 12-29-2013, 09:53 AM
  5. Using Avergeifs and selecting last 8 cells based on criteria
    By boyesmar in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 12-23-2013, 09:20 PM
  6. Selecting Range of Cells based on Criteria
    By gmclauchlan in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-10-2011, 12:19 PM
  7. Selecting random cells using certain criteria
    By tcpace in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 04-23-2007, 11:50 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