filter out randomly?

G

Guest

Can I ask Access to filter out say, 100, randomly chosen records from a large
list? ie no criteria but just specify the number of random records I want?

Thanks
Sally T

PS If not - does anyone know how to do this in Excel?
 
M

Marshall Barton

sally said:
Can I ask Access to filter out say, 100, randomly chosen records from a large
list? ie no criteria but just specify the number of random records I want?


SELECT TOP 100 keyfield, posfield, fieldA, . . .
FROM table
ORDER BY Rnd(posfield)

Don't forget to use the Randomize statement somewhere before
running the query.

The field name used in the Rnd function can be any field
that contains only positive numbers, no zeros, no negatives
and no Nulls.
 
G

Guest

many thanks!

sally

Marshall Barton said:
SELECT TOP 100 keyfield, posfield, fieldA, . . .
FROM table
ORDER BY Rnd(posfield)

Don't forget to use the Randomize statement somewhere before
running the query.

The field name used in the Rnd function can be any field
that contains only positive numbers, no zeros, no negatives
and no Nulls.
 
G

Guest

Excel can by adding another column and filling with number generated using
the random function. Soet on the random number column and then select the
first 100.
 

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