How do I pull a name out of a list - randomly?

S

S Clause

Hi All.

I have a list of names from which I have to randomly select one as the
winner of a prize. The length of the list varies depending upon the number
of respondents. I'm sure there must be a way to pull a name out of the
"hat" so to speak, but I don't know how. Currently I am asking people to
pick a number - which is working, but I would like to automate the process.

Can anyone help?
 
K

Ken

I didn't try this, but maybe ...


RANDBETWEEN

Returns a random number between the numbers you specify. A
new random number is returned every time the worksheet is
calculated.

If this function is not available, run the Setup program
to install the Analysis ToolPak. After you install the
Analysis ToolPak, you must enable it by using the Add-Ins
command on the Tools menu.

How?

Syntax

RANDBETWEEN(bottom,top)

Bottom is the smallest integer RANDBETWEEN will return.

Top is the largest integer RANDBETWEEN will return.

HTH ... Kha
 
R

Ron Rosenfeld

Hi All.

I have a list of names from which I have to randomly select one as the
winner of a prize. The length of the list varies depending upon the number
of respondents. I'm sure there must be a way to pull a name out of the
"hat" so to speak, but I don't know how. Currently I am asking people to
pick a number - which is working, but I would like to automate the process.

Can anyone help?

If your list of names is stored in an array called Names, and if there are no
blanks, (and if you are happy with Excels random number function) then:

=INDEX(Names,randbetween(1,COUNTA(Names)))

If the RANDBETWEEN function is not available, and returns the #NAME? error,
install and load the Analysis ToolPak add-in.




--ron
 
J

Jordon

Put =rand() in the cells next to the name.

Calculate the worksheet. Sort the worksheet based on
that column.

Pick the first person at the top of the list.

Recalculate and resort and you can get a new winner.

Cool. I took this a step further and created a macro that
sorts the list, hides the rows for any names except the
one on top and then put a button on the sheet to start the
macro.

Jordon
 
B

Buckwheat

Jordon,

I'm trying to switch from 1-2-3 to Excel, and have been searching help
files trying to find a way to put buttons in worksheets that will run a
macro. I noticed your post, and was wondering if you could point me in the
right direction. TIA,

Buckwheat.
 
K

Kevin Stecyk

Buckwheat,

PMFJI, One of the easiest ways to put a button on spreadsheet is to use the
forms toolbar (right mouse click on any toolbar, and then choose forms
toolbar). Select the button on the toolbar, and then create you button.
You should be prompted for the rest, or you can right mouse click the newly
created button and supply the appropriate parameters.

Kevin
 
B

Buckwheat

Kevin,

Thanks for the help. I've made my first two macro buttons and am thrilled
I don't have to mess with keyboard shortcuts for my macros. You made my
day! I may make this transitions to XL from 10 years of Lotus 1-2-3 and
Lotusscript after all.

Buckwheat
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top