how to count specific values only not total count

S

steven

I am using Access 2000 - I have one column of numbers (probably 1000 numbers
in total) ranging from 1 to 9 - Does anyone know how I can count the times
that each specific number appears - for instance - count the total number of
ones, count the total number of two's, three's, four's etc.

I have tried this in a query and have not yet been successful - does it need
to go only in a report?

Thank you very much - Steven
 
P

pietlinden

I am using Access 2000 - I have one column of numbers (probably 1000 numbers
in total) ranging from 1 to 9 - Does anyone know how I can count the times
that each specific number appears - for instance - count the total numberof
ones, count the total number of two's, three's, four's etc.

I have tried this in a query and have not yet been successful - does it need
to go only in a report?

Thank you very much - Steven

use a totals query.

SELECT Value, Count(Value)
FROM MyTable
ORDER BY Value
GROUP BY Value;
 
R

RonaldoOneNil

You can do it in a query. Put the field that contains the numbers into a
query twice.
Click on the Sigma (totals) button on the query toolbar. You will see total
row appear in your query grid with gruoup by set as default. Leave the first
group by alone but change the 2nd one to Count.
 
B

Brian

Ensure that your table has at least one more field (besides the number, and
you can create one by simply adding an AutoNumber field to the table), then
do this:

Create a query, adding the number field and any other field to it. Click the
Sum button (Greek Sigma, somewhat like a capital E). Then change the Total to
GroupBy for the number field and Count for the other one. The Count result
will be the # of occurences of each number.

If your query has only the one field, you can do the same thing, but after
grouping by the number field, add another field: RecordCount: Count(*) with
Total as Expression (Access will not let you add the * summary by
double-clicking it)
 

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