Macro to randomly choose from a list

  • I've been looking everywhere to try and find a way to create a macro/vba thing to help me with a worksheet im currently completing.


    I imagine it/need for it to randomly choose two names from the COMPETITORS tab and place one name in column B and one name in column I of the MATCHES tab on the same line and go down to the latest line available (as represented by the game/column a) without repeating a name.


    Provided that its not that much effort to add additional requests, i would need it to do additional things as a seperate option.

    -Only choose two names randomly that appear in the same "Class" as per column K in COMPETITORS tab

    -Allow names to be repeated


    Any help or suggestions would be gratefully appreciated


    Comp.xlsx

  • Hi,


    Thanks for your reply.


    I've never heard of Power Query before and a quick search on what it does and how it has worked on my file.


    Not sure if it necessarily does what i need it to but thanks

  • Do I understand it?

    grab 2 random cells in worksheet competitors column a, optionally with same the same class, optionally with names already in worksheet matches column a


    Paste both cells in worksheet matches, 1 in column B and 1 in I on the same row


    Question:

    1. If names are allowed to be repeated, how many rows do you want?

  • Hi,


    Basically i want it to randomly choose two names and place one each in column B and one in column I within the same row


    I want to try and have 3 options for the above: One where no names get repeated, one where names can be repeated but not required, and one where only names within the same "category" can be chosen


    The amount of rows/"matches" havent been determined yet but would essentially be in the hundreds due to the various combinations that would be available