Highlighted
New Contributor

# Vlookup and RandBetween Function

Hello All,

I am trying to generate a list of 6 unique names from a list of names with a number value assigned to them.  However, When doing the below function I am getting multiples of the same name. I.E : John, John, David, Smith, Dustin, Dustin.

=VLOOKUP(RANDBETWEEN(1,\$J\$2),\$A:D,4,TRUE)

Is there any way I can use this code to pick a random name from my list and the second name be a random name from the same list and if it selects a name that has been used before it selects a different name?

3 Replies
Highlighted

# Re: Vlookup and RandBetween Function

Are you able to put the random number next to each name in the list?

You could then pull that data into Pivot Table and do a Top 5

Or if you have Excel 365 you could use the SORTBY function to return a sorted list and then reference the first 5 rows of that in another formula.

If you have 365 I'll attach an example later.
Highlighted

# Re: Vlookup and RandBetween Function

@Wyn Hopkins The names are associated with a group of numbers such as name 1 is any number from 1-71 and there are several names with several different numbers values for each name,  Which makes this a little harder.  I want the second name to take a random number and if it generates the same as the first name it selects another random number to get a different name.

Highlighted

# Re: Vlookup and RandBetween Function

Any chance you can upload a sample file with an example?