+ Reply to Thread
Results 1 to 3 of 3

Picking subselection randomly if true

  1. #1
    Registered User
    Join Date
    04-02-2007
    Posts
    5

    Picking subselection randomly if true

    I've been chewing on this issue for quite a while, and I finally decided to make a demo spreadsheet and throw it out to you smarter VBA folks. All the data on the spreadsheet is made up (which took longer than I thought it would).

    Basically I get a list of about 500 accounts, then I apply a macro that puts the word TRUE next to accounts that meet certain criteria. From there I want to randomly assign a number of 1-20 to accounts that have the word TRUE in column M (replace TRUE with a number). I can't have the same agreement number pulled twice, each record with a number 1-20 must be unique (you'll see what I mean in the spreadsheet).

    Basically my end goal here is to have a macro that randomly samples 20 different agreements out of many that meet the TRUE requirement.

    Thanks in advance for your help, my brain is killing me.
    Attached Files Attached Files

  2. #2
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: Picking subselection randomly if true

    In N2 and copy down, =IF(M2, rand(), "")

    Sort by column N and pick the first 20.
    Entia non sunt multiplicanda sine necessitate

  3. #3
    Registered User
    Join Date
    04-02-2007
    Posts
    5

    Re: Picking subselection randomly if true

    Thanks for the reply! I tried doing that, however, when I sort it puts duplicates in the first 20. Also, I need a macro that will automatically replace the word true with a number. (I have to automate this fully). Thanks again!

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

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