Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Excel Query 1

Status
Not open for further replies.

whatcom

Technical User
Aug 27, 2007
8
US
Hello.

I am trying to query data from a SQL Server into Excel. To keep things simple, I am just trying to query one table, and look at three fields: NUMBER, TYPE, DATE. In the Query Wizard, I set up the Filter Data screen, and then the Sort Order screen. Once that is done, I click the [Finish] button, and the results show up in excel as I had hoped.

Here's my problem, in addition to the data returned, I would like to have a total count of records. I know I can do this after, but how do I get the returned results to include a "total count".

Does that make sense? Hopefully it does. If you have any advice or suggestions, please let me know.

Thanks!
 




Hi,

Just count the entries in the column. Assuming that your query is in A1 with no other data below the querytable, it's just...
[tt]
=COUNTA(A:A)-1
[/tt]
assuming that you return the heading row as well.

Skip,

[glasses] When a wee mystic is on the loose..
It's a Small Medium at Large! [tongue]
 





...AND assuming that there is a VALUE in each row in Column A.

Skip,

[glasses] When a wee mystic is on the loose..
It's a Small Medium at Large! [tongue]
 
Adding the count to the query would return the number for each record. It would look like this:
[tt]
Thing1 Thing2 Count

asdf asdf1 321
qwerty qwerty1 321
... ... 321[/tt]

Best to count them up once they're in Excel, like Skip suggested.

[tt]_____
[blue]-John[/blue][/tt]
[tab][red]The plural of anecdote is not data[/red]

Help us help you. Please read FAQ 181-2886 before posting.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top