How to randomize from large excel sheet of names | XM Community
Skip to main content
Hello,



Sorry if I am on the wrong subforum, but I was curious on what is the most efficient way to randomize a large set of names across a set of question blocks. The names are contained in a excel sheet. The specifics are that I have 4 categories (White/M, White/F, African/M, African/F) of 20 names each. I have 1 question per block where I would like it to randomly choose a category and then randomly choose a name from within that category without replacement. Hence, given it randomly drew the category White/M, and then drew a name from that category, the next block cannot pull from that category again. There are 4 blocks so each block should draw a name from each unique category.



Again, is there an easy way of doing this? Java? Could I manage this with embedded code and randomizer?



Thanks for the help in advance, and if anything is unclear I can show you at least where I would want it randomized.



Cheers,



Nicholas
Hi gametheoryguy93,



Java would be much simpler, but you can accomplish this with embedded code and randomization. If you're proficient with Java, I'd strongly suggest asking in the Developer Corner. If you prefer to do this with embedded data, it will be pretty convoluted to randomly pick 1 category that hasn't been picked before and then pick the name, but I can walk you through it if you like.



Cheers,



Elliot V.W.
I have literally no knowledge of Java, so the convoluted embedded data approach would seem to be the preference here for me. I might want to send screen shots just so you know what the survey flow looks like..
Happy to help figure this out! Here is how I would set this up based on what you've posted so far with some screenshots:



Name Randomization - Set up one randomizer per category name with 20 options each. https://uploads-us-west-2.insided.com/qualtrics-us/attachment/tm_3kzeov7rpghd.png



Block Category Variables - Set these up as placeholders for the each block.

https://uploads-us-west-2.insided.com/qualtrics-us/attachment/x9_fiaqb2so6dgv.png



Category Randomization - Set up one randomizer for each block variable with branches to only continue if the corresponding block variable still = 0 (so it's empty) and if previous blocks don't have the same category.

https://uploads-us-west-2.insided.com/qualtrics-us/attachment/no_tffruxx254o4.png



Block Names - Set up branches which insert the randomized name from the randomized category into a name variable for each block. You can then pipe that name variable into the question text of the corresponding block.

https://uploads-us-west-2.insided.com/qualtrics-us/attachment/3t_1ug4i9oewrto.png



Cheers,



Elliot V.W.
Ahhhhh it worked! Thank you so much, Elliot! Also, thanks for saving me the trouble of having to learn Java.



Have a nice day!

Leave a Reply