Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 2
Default How do I get Excel to select a random entry for me?

I heard that I shoudl be able to have Excel make a random selection of a
record for me (for a raffle prize). Is this possible? And if so, how do I
do this?
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 897
Default How do I get Excel to select a random entry for me?

Here is a UDF you can use, the instructions are below.


Function DrawOne(InRange As Variant)
'
' highlight a range and this function returns one randomly selected
value,
' text or number
' =DRAWONE(A1:C100)
'
'
Randomize
DrawOne = InRange(Int((InRange.count) * Rnd + 1))

End Function


HTH,
JP

On Jan 14, 2:41*pm, Solitaire
wrote:
I heard that I shoudl be able to have Excel make a random selection of a
record for me (for a raffle prize). *Is this possible? *And if so, how do I
do this?


  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 11,058
Default How do I get Excel to select a random entry for me?

First put your records in a list say from A1 thru A1000. In another cell:

=INDIRECT("A" & RANDBETWEEN(1,1000))

--
Gary''s Student - gsnu200765


"Solitaire" wrote:

I heard that I shoudl be able to have Excel make a random selection of a
record for me (for a raffle prize). Is this possible? And if so, how do I
do this?

  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 1
Default How do I get Excel to select a random entry for me?

On Jan 14, 2:41*pm, Solitaire
wrote:
I heard that I shoudl be able to have Excel make a random selection of a
record for me (for a raffle prize). *Is this possible? *And if so, how do I
do this?


Or you can use this one: =INDEX($A$1:$A$12,randbetween(1,12))

Where A1:A12 = a list you want to select randomly from.
  #5   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 2
Default How do I get Excel to select a random entry for me?

Thank you, JP.

I really appreciate your help, but I'm sorry to say that I'm not quite
following. I can usually figure things out intuitively, but I think I need
you to be more literal, if you don't mind (e.g., step one: do this, step two:
do this). If you have the time, I would greatly appreciate it.

Solitaire

"JP" wrote:

Here is a UDF you can use, the instructions are below.


Function DrawOne(InRange As Variant)
'
' highlight a range and this function returns one randomly selected
value,
' text or number
' =DRAWONE(A1:C100)
'
'
Randomize
DrawOne = InRange(Int((InRange.count) * Rnd + 1))

End Function


HTH,
JP

On Jan 14, 2:41 pm, Solitaire
wrote:
I heard that I shoudl be able to have Excel make a random selection of a
record for me (for a raffle prize). Is this possible? And if so, how do I
do this?





  #6   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 80
Default How do I get Excel to select a random entry for me?

Do this:
#1 - create a sample list of names in Column A. Create 10 names down
the column (i.e. A1=Bob, A2=Sam, etc.)
#2 - In Cell B1 (or any cell you choose, paste this formula: =INDEX($A
$1:$A$10,randbetween(1,10))
#3 - View the result. It should display a random name. Copy the
formula to multiple cells and you will see multiple random names
selected (do this just to show the random feature at work).
#4. Randbetween selects a random number between the numbers you
enter. Randbetween(1,10) selects any number at random between 1 and
10. Index is an Excel method to choose a cell within a range.
Literally the formula means this:
=index(within this range,select this cell).

Get it now?

  #7   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 1
Default How do I get Excel to select a random entry for me?

Thank you, yes. I really appreciate you explaining this to me in more
detail.

"HKaplan" wrote:

Do this:
#1 - create a sample list of names in Column A. Create 10 names down
the column (i.e. A1=Bob, A2=Sam, etc.)
#2 - In Cell B1 (or any cell you choose, paste this formula: =INDEX($A
$1:$A$10,randbetween(1,10))
#3 - View the result. It should display a random name. Copy the
formula to multiple cells and you will see multiple random names
selected (do this just to show the random feature at work).
#4. Randbetween selects a random number between the numbers you
enter. Randbetween(1,10) selects any number at random between 1 and
10. Index is an Excel method to choose a cell within a range.
Literally the formula means this:
=index(within this range,select this cell).

Get it now?


  #8   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 897
Default How do I get Excel to select a random entry for me?

Here you go:

1. Open Excel, click Alt-F11 to go to the VB Editor
2. Click InsertModule on the toolbar
3. Paste this code into the module:

Function DrawOne(InRange As Variant)
'
' highlight a range and this function returns one randomly selected
value,
' text or number
' =DRAWONE(A1:C100)
'
Randomize
DrawOne = InRange(Int((InRange.count) * Rnd + 1))

End Function

4. Make a note of the module name (i.e. 'Module1', 'Module2' etc)
5. In your worksheet enter =DRAWONE(your range)

For example if you have the names for the raffle in A1 through A10,
enter =DRAWONE(A1:A10) in any cell. If the formula returns a NAME
error, you will have to prefix the formula with the module name from
step 4. For example =Module1.DRAWONE(A1:A10) if you pasted the code
into Module1.

If you need further assistance check out http://www.rondebruin.nl/code.htm
on how to paste code

HTH,
JP

On Jan 14, 3:24*pm, Solitaire
wrote:
Thank you, JP. *

I really appreciate your help, but I'm sorry to say that I'm not quite
following. *I can usually figure things out intuitively, but I think I need
you to be more literal, if you don't mind (e.g., step one: do this, step two:
do this). *If you have the time, I would greatly appreciate it.

Solitaire


On Jan 14, 2:41 pm, Solitaire

wrote:
I heard that I shoudl be able to have Excel make a random selection of a
record for me (for a raffle prize). *Is this possible? *And if so, how do I
do this?- Hide quoted text -


- Show quoted text -


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
select random value in a range of cells Pete Morris Excel Discussion (Misc queries) 4 March 30th 07 09:26 PM
Select a random sample IPMS Excel Discussion (Misc queries) 2 January 7th 07 02:54 AM
random number entry based on two criteria SSG QuarterMaster Excel Discussion (Misc queries) 0 October 5th 06 03:20 AM
Random select entries brodiemac Excel Discussion (Misc queries) 2 September 9th 06 03:01 AM
Select random cell SammyJJones Excel Worksheet Functions 4 November 11th 05 01:56 AM


All times are GMT +1. The time now is 12:44 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"