Counting Data From A Query

D

Dmorri254

Hello,
Here is am example of data pulled from a query into excel. What I need to do
is create a many to one relationship after the data is pulled:
Date Num Incident Completion Date
12/16/2004 326 39413 1/13/2005
12/16/2004 326 38314 1/13/2005
12/16/2004 326 35602 1/13/2005

So all the incidents related to num 326 should display as a count of how
many there are (3), the date shuld just display 12/16/2004 and there should
only be one completion date 1/13/2005...ca this be done without creating
another sheet to massage the data? Can it be done when it is pulled?

Thanx
 
R

Rob van Gelder

Could your query would return the data in the format desired?
eg. select date, num, count(incident), competion_date from incident_table
where num = 326 group by date, num, completion_date

Alternatively, I suggest a pivottable.

Highlight your range, eg. A1:D4
From the Data menu, select PivotTable
Click Next through the options until the button for Layout appears - click
it.
Drag all of the fields into Row except Incident which goes into Data
It will probably say Sum of Incident. Doubleclick it and change to Count of
Incident.

You can play with the PivotTable options to remove SubTotals etc..
 

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