+ Reply to Thread
Results 1 to 4 of 4

Macro Help - Random Select

  1. #1
    Registered User
    Join Date
    07-04-2014
    Location
    Leeds
    MS-Off Ver
    2007
    Posts
    2

    Macro Help - Random Select

    Hi Guys,

    I am looking for a little bit of help with a macro.

    I have the following sheets.

    Summary
    User1
    User2
    User3

    For user1 through user3, these sheets are populated via data connection.

    What I need is for a macro to randomly pick an entry from each user1 user2 and user 3, and copy this to summary sheet (only copying specific columns. So if it randomly picks A19, then A19, E19, etc are then copied to summary sheet).

    Once this has been done, the following day, the user1/2/3 data will be refreshed, so running the macro again will copy new data to the "next" blank rows in the Summary sheets range.
    So Mondays 3 entries will be ranged A2:A5, Tuesday will be A6:A9

    Also then need a clear button to be used on friday to then remove all the data ready to start again on the monday

    Anyone able to point me in the right direction? (may need more than a single macro )

    Thanks

  2. #2
    Valued Forum Contributor
    Join Date
    08-07-2014
    Location
    Quito, Ecuador
    MS-Off Ver
    Excel 2016 & 365, Windows 10
    Posts
    511

    Re: Macro Help - Random Select

    @ Silkk

    Check the attached file
    I hope it's what you are looking for

    Vicho
    Attached Files Attached Files
    Barriers are there for those who don't want to dream

  3. #3
    Registered User
    Join Date
    07-04-2014
    Location
    Leeds
    MS-Off Ver
    2007
    Posts
    2

    Re: Macro Help - Random Select

    Sorry, Although that helped, it wasnt quite what I was looking for.

    I have attached an example of the sheet I am working from.

    On the master sheet, I want the macro to look at the RawData_SC sheet.
    But when pulling the random information relating to "number" from RawData_SC column A, i want 1 random number for each entry on the "Analysts" sheet.
    So from the rawdata, it can see that 25 entries are from Adam and 15 are from Gavin, but I want 1 random for each.

    I also need the macro to populate these into columns, so all numbers go into column A, all analyst names go into column B.

    So for column B it would need an if statement to look at whatever was listed in column A to be then used as the variable to export the required data to column C/D/E/F etc.

    Once this has been done, the next time you press Generate, it runs through again, pulling in new information but adding this to the bottom of the data that is already there.
    It cant be exported to Row's as I will be using the row's.

    So example data would be:

    Result 1 Column A6 (Todays Date), Column B6 (Number), Column C6 (Analyst Name), Column D6 (Company Name).
    Result 2 Column B7 (Number), Column C7 (Analyst Name), Column D7 (Company Name).


    As the RawData_SC is using a data connection, I cant use a VLOOKUP to pull the information in an array, as once it is refreshed, the previous data is fluhed, which is why I need it to hard copy the data to the new cells.

    Hopefully this now makes sense
    Attached Files Attached Files

  4. #4
    Valued Forum Contributor
    Join Date
    08-07-2014
    Location
    Quito, Ecuador
    MS-Off Ver
    Excel 2016 & 365, Windows 10
    Posts
    511

    Re: Macro Help - Random Select

    I have some questions for you Silkk,

    In the book you attached to the last post, the only way that I find to relate the analyst with the sheet is the column "opened_by"
    But in this column I found 49 different Names, (including one named as "problem"), while in your analysts sheet there are only 14 names
    In this column there is only 1 entry for Adam ( not 25 as you wrote up); and 41 records for Gavin ( not 15)

    So you have to clarify how to select the Analyst in the RowData_SC sheet.
    Which analyst do you want to check, and take one random line from:
    All named in the RowData_SC sheet ?
    or only those named in the Analysts sheet ?

+ 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. Macro to select 10 random records from list with 2 filters
    By Iceman1988 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 06-02-2013, 01:17 PM
  2. Random Select Macro - Compile Error: Sub or Function not defined.
    By SalientAnimal in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-29-2013, 04:46 AM
  3. Random Row Select and Copy
    By xtiankmasajo in forum Excel General
    Replies: 4
    Last Post: 02-20-2013, 11:21 PM
  4. select 10% from a random value
    By sput_sput in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 04-14-2010, 03:05 AM
  5. Random Select one of two or more numbers
    By mark_varney47 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-17-2006, 11:27 PM
  6. [SOLVED] Random select entries
    By brodiemac in forum Excel General
    Replies: 1
    Last Post: 06-27-2006, 10:20 AM
  7. How can I select random whole nos from 1-16 without repeating?
    By ilena in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 12-14-2005, 03:40 AM
  8. [SOLVED] Select random cell
    By SammyJJones in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 11-10-2005, 10:10 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