ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   Random Sample with multiple data points (https://www.excelbanter.com/excel-worksheet-functions/228374-random-sample-multiple-data-points.html)

Jeremy

Random Sample with multiple data points
 
I have a list of people with a large number of lines per person. I need to
randomly select two lines for each person. The report is preformatted and
downloaded daily. The names are listed in column C. How can I do this?

Gary''s Student

Random Sample with multiple data points
 
Say we have 20 "Mike" lines, then 10 "James" lines, then 50 "Sally" lines, etc.

It does not matter if the lines are grouped together or not. In an un-used
column (say column Z), enter:

=RAND() and copy down

First the table by column Z. This will randomize the records. Then sort
the table by column C. This will group the names together, but in a random
order. All the "Mike"s will be grouped, but the order of the "Mike"s
shuffled.

Then just take the first two "Mike"s, the first two "James"s, etc.
--
Gary''s Student - gsnu200847


"Jeremy" wrote:

I have a list of people with a large number of lines per person. I need to
randomly select two lines for each person. The report is preformatted and
downloaded daily. The names are listed in column C. How can I do this?



All times are GMT +1. The time now is 09:14 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com