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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Msquery import to Excel

Status
Not open for further replies.

MIKElaw

Programmer
Nov 4, 2000
116
GB
Data into Excel via MSquery from ODBC

I have
A 1 2 4 5 6 7
B 1 1 1 1 1 1
B 1 2 2 2 2 3
C 1 1 1 1 1 1

what I need in Excel is
A 1 2 4 5 6 7
B 2 3 3 3 3 4
C 1 1 1 1 1 1

In other words sum all columns if the first col are the same
Am repairing someone else's work from 4-5 years ago and not very used to MsQuery but generally Ok on SQL


 




You'll need SQL something like this, a you have NO HEADINGS...
[tt]
Select
F1
, SUM(F2)
, SUM(F3)
, SUM(F4)
, SUM(F5)
, SUM(F6)
, SUM(F7)
From [YourSheetName$]
Group By F1
[/tt]
If you want no headings in the QueryTable results, Data > Data Range Properties has a checkbox to control that.

Skip,

[glasses]Just traded in my old subtlety...
for a NUANCE![tongue]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top