Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 4
Default Randomly Select Records

I need a way to randomly select 400 records from a worksheet containing
around 2000. Is there a formula or function that will do this?
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 11,058
Default Randomly Select Records

Say your data is in A1 thru A2000

1. in B1 thru B2000 enter:
=RAND()
2. sort columns A & B by column B
3. pick the first 400 items in column A
--
Gary''s Student
gsnu200710


"Critzy" wrote:

I need a way to randomly select 400 records from a worksheet containing
around 2000. Is there a formula or function that will do this?

  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 4
Default Randomly Select Records

When I use your formula, it is generating only large decimal numbers that
aren't sorting correctly. Is there something to add to the formula so that
it will generate whole numbers only?

"Gary''s Student" wrote:

Say your data is in A1 thru A2000

1. in B1 thru B2000 enter:
=RAND()
2. sort columns A & B by column B
3. pick the first 400 items in column A
--
Gary''s Student
gsnu200710


"Critzy" wrote:

I need a way to randomly select 400 records from a worksheet containing
around 2000. Is there a formula or function that will do this?

  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 11,058
Default Randomly Select Records

Whole numbers would be bad. Here is a 10 item example (instead of 2000) in
A1 thru B10:

first record 0.101136315
second record 0.261871674
third record 0.256612485
fourth record 0.37613248
fifth record 0.869187556
sixth record 0.601846916
seventh record 0.316891978
eighth record 0.239924396
nineth record 0.022173703
tenth record 0.414456984


and after the sort:

nineth record 0.022173703
first record 0.101136315
eighth record 0.239924396
third record 0.256612485
second record 0.261871674
seventh record 0.316891978
fourth record 0.37613248
tenth record 0.414456984
sixth record 0.601846916
fifth record 0.869187556


As you see the order of records in column A is randomized. Just get the top
4 or 400 for your sample.
--
Gary''s Student
gsnu200710


"Critzy" wrote:

When I use your formula, it is generating only large decimal numbers that
aren't sorting correctly. Is there something to add to the formula so that
it will generate whole numbers only?

"Gary''s Student" wrote:

Say your data is in A1 thru A2000

1. in B1 thru B2000 enter:
=RAND()
2. sort columns A & B by column B
3. pick the first 400 items in column A
--
Gary''s Student
gsnu200710


"Critzy" wrote:

I need a way to randomly select 400 records from a worksheet containing
around 2000. Is there a formula or function that will do this?

  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Max Max is offline
external usenet poster
 
Posts: 9,221
Default Randomly Select Records

One variation to play with ..

Assume your source records is in A1:A2000

Place in B1: =RAND()
Copy down to B2000

Then place in say, C1:
=INDEX(A:A,RANK(B1,$B$1:$B$2000))
Copy C1 down by 400 rows to C400

C1:C400 will return 400 random, non-duplicating picks
from the source within A1:A2000

Press F9 to re-generate
--
Max
Singapore
http://savefile.com/projects/236895
xdemechanik
---
"Critzy" wrote:
When I use your formula, it is generating only large decimal numbers that
aren't sorting correctly. Is there something to add to the formula so that
it will generate whole numbers only?




  #6   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 11,058
Default Randomly Select Records

GREAT solution...You don't even have to sort the original data.
--
Gary''s Student
gsnu200710


"Max" wrote:

One variation to play with ..

Assume your source records is in A1:A2000

Place in B1: =RAND()
Copy down to B2000

Then place in say, C1:
=INDEX(A:A,RANK(B1,$B$1:$B$2000))
Copy C1 down by 400 rows to C400

C1:C400 will return 400 random, non-duplicating picks
from the source within A1:A2000

Press F9 to re-generate
--
Max
Singapore
http://savefile.com/projects/236895
xdemechanik
---
"Critzy" wrote:
When I use your formula, it is generating only large decimal numbers that
aren't sorting correctly. Is there something to add to the formula so that
it will generate whole numbers only?


  #7   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Max Max is offline
external usenet poster
 
Posts: 9,221
Default Randomly Select Records

Thanks for the feedback, GS !
--
Max
Singapore
http://savefile.com/projects/236895
xdemechanik
---
"Gary''s Student" wrote:
GREAT solution...You don't even have to sort the original data.
--
Gary''s Student
gsnu200710


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
how to randomly select data in excel random selection of data Excel Worksheet Functions 4 October 4th 06 01:51 AM
Randomly select numbers from a range Fred Smith Excel Discussion (Misc queries) 15 October 3rd 06 02:01 AM
how to randomly select a name in a list and then the select the ne [email protected] Excel Worksheet Functions 1 September 20th 06 08:09 AM
randomly select numbers jollycarrier Excel Discussion (Misc queries) 2 August 18th 06 02:54 PM
randomly select value WITHOUT changing Doyle Brunson Excel Worksheet Functions 3 August 26th 05 12:52 AM


All times are GMT +1. The time now is 05:43 PM.

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

About Us

"It's about Microsoft Excel"