Help with a simple (?) count query

rexnervous

New Member
Joined
Aug 6, 2003
Messages
6
Have a single table with date, gender, age, county. Need to build a query/report(s) that does the following:

1. Need one that gives me # of males assigned to each date. So I can tell someone there were 12 males assigned to January 2nd, 2 males to January 3rd etc.

2. Need to do the same with age, but within certain age ranges. This I assume will be the same as above, but I'll just run a new query for each age range.

3. Now a little more complicated - I need to do the same with county, but there are multiple counties. So I'd need a table report that goes:
Date | County A | County B | etc
Jan 1st 12 4 etc.

I know how to build basic queries, but am having trouble with the count thingy, as well outputting to a report.

Thanks in advance.
 

Excel Facts

Ambidextrous Undo
Undo last command with Ctrl+Z or Alt+Backspace. If you use the Undo icon in the QAT, open the drop-down arrow to undo up to 100 steps.
I think this will work

1. If you creare a query with the following fields Gender, Date, Date. Then you "Group By" the first 2 fields and "Count" the last field. Then you just put the criteria "Male" on the first field. That should give you the number of males for each date.

2. You're right the same thing as 1.

3. If you do the same as 1, you should get what you need.
 
Upvote 0
For putting the counties across the columns, you need to use a crosstab query. There's a wizard for building them. Using the Date-restricted query as a data source:
Put Gender into Row
Put County into Column
Put Name (or whatever) into Data, and select Count as the summary function.

To put this into a report, first check that the crosstab is OK and then run the Report wizard. Use the new crosstab query as the data source, and insert all fields. When you run the report you will be prompted for the dates, and all will be revealed.

Denis
 
Upvote 0

Forum statistics

Threads
1,221,547
Messages
6,160,456
Members
451,647
Latest member
Tdeulkar

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top