Query to group and count demographic data

G

Guest

I have a table that contains gender and age. I need to write a query that
would give me counts for Males ages 30-50, Females ages 30-50, Males ages
51-60 and so on. The end result might look like this:

30-50 51-60 61-70 71-80
Males 5 12 9 4
Females 7 13 8 7

Thanks
 
D

Duane Hookom

The most flexible method would be to create a table of Age Ranges:

tblAgeRanges
==================
RangeMin number
RangeMax number
RangeTitle Text

Then add records like
30 50 "30-50"
51 60 "51-60"
etc

You can then add this table to a query with your genders and ages and set
the criteria under the Age column to:
Between [RangeMin] and [RangeMax]
Then change this to a crosstab query and use Gender as the Row Heading,
RangeTitle as the Column Heading, and Count of Age as the Value.
 

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