A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Running & Setting Up Queries
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Create query that sums up categorical data



 
 
Thread Tools Display Modes
  #1  
Old May 9th, 2008, 03:00 AM posted to microsoft.public.access.queries
Liz Yetter
external usenet poster
 
Posts: 1
Default Create query that sums up categorical data

Hi-
I need some help with Access 2003 queries. Please keep in mind that I
am NOT a programmer.

I have a table filled with gender (male or female), race (black,
white, asian, etc), and ethnicity (hispanic, not hispanic, unknown).
I need to find a way to do a query that will tell me the following:
1. how many males
2. how many females
3. how many white males, white females, black males, etc.
4. how many white hispanic males, how many white nonhispanic males,
how many black hispanic males, etc...
5. How many of 1,2,3,&4 between particular dates.

I'm not sure if I'm doing this right, but basically, I need the query
to spit out a number and not just line up all the males like it's been
doing.

Any help is appreciated.
Thanks!
Liz
  #2  
Old May 9th, 2008, 04:08 AM posted to microsoft.public.access.queries
Duane Hookom
external usenet poster
 
Posts: 7,177
Default Create query that sums up categorical data

I wouldn't even try to do this with a single query. You have lots of
individual simple queries that can return your results. If you want to
display all of these in a report, you can place multiple subreports based on
your individual queries.

--
Duane Hookom
Microsoft Access MVP


"Liz Yetter" wrote:

Hi-
I need some help with Access 2003 queries. Please keep in mind that I
am NOT a programmer.

I have a table filled with gender (male or female), race (black,
white, asian, etc), and ethnicity (hispanic, not hispanic, unknown).
I need to find a way to do a query that will tell me the following:
1. how many males
2. how many females
3. how many white males, white females, black males, etc.
4. how many white hispanic males, how many white nonhispanic males,
how many black hispanic males, etc...
5. How many of 1,2,3,&4 between particular dates.

I'm not sure if I'm doing this right, but basically, I need the query
to spit out a number and not just line up all the males like it's been
doing.

Any help is appreciated.
Thanks!
Liz

  #3  
Old May 9th, 2008, 12:55 PM posted to microsoft.public.access.queries
John Spencer
external usenet poster
 
Posts: 7,815
Default Create query that sums up categorical data

You need to use a totals query to get the results you seek

For instance
SELECT Gender, Count(Gender) as CountGender
FROM YourTable
GROUP BY Gender

In the query grid, you would use
-- Create a new query with your table
-- Add the Gender field TWICE
-- Select View: Totals from the menu
-- Change the second GROUP BY to Count

If you want to do this for Gender and Race at the same time
-- Create a new query with your table
-- Add the Gender and the race field
-- Select View: Totals from the menu
-- In a blank Field "cell" enter
CountThem: Count(*)
-- Set the TOTAL "cell" to EXPRESSION


John Spencer
Access MVP 2002-2005, 2007-2008
Center for Health Program Development and Management
University of Maryland Baltimore County

Liz Yetter wrote:
Hi-
I need some help with Access 2003 queries. Please keep in mind that I
am NOT a programmer.

I have a table filled with gender (male or female), race (black,
white, asian, etc), and ethnicity (hispanic, not hispanic, unknown).
I need to find a way to do a query that will tell me the following:
1. how many males
2. how many females
3. how many white males, white females, black males, etc.
4. how many white hispanic males, how many white nonhispanic males,
how many black hispanic males, etc...
5. How many of 1,2,3,&4 between particular dates.

I'm not sure if I'm doing this right, but basically, I need the query
to spit out a number and not just line up all the males like it's been
doing.

Any help is appreciated.
Thanks!
Liz

 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 11:10 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.