Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
'Group by' facility?
Hi,
I've a lot of csv files to process. In each one I need to summ some columns where one or two other columns are the same. In a database table this would be easy using a SQL 'group by' statement. Is there a similar method I could use in VBA? Thanks in advance SW |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
'Group by' facility?
Pivot tables are about as close as you'll get. Unless you want to treat the
same workbook as a Jet SQL source and query it. -- Rob van Gelder - http://www.vangelder.co.nz/excel "Steve W" wrote in message ... Hi, I've a lot of csv files to process. In each one I need to summ some columns where one or two other columns are the same. In a database table this would be easy using a SQL 'group by' statement. Is there a similar method I could use in VBA? Thanks in advance SW |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
'Group by' facility?
Treating it as a Jet SQL source sounds useful. How do I do that?
Thanks SW "Rob van Gelder" wrote in message ... Pivot tables are about as close as you'll get. Unless you want to treat the same workbook as a Jet SQL source and query it. -- Rob van Gelder - http://www.vangelder.co.nz/excel "Steve W" wrote in message ... Hi, I've a lot of csv files to process. In each one I need to summ some columns where one or two other columns are the same. In a database table this would be easy using a SQL 'group by' statement. Is there a similar method I could use in VBA? Thanks in advance SW |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
'Group by' facility?
SW wrote:
Treating it as a Jet SQL source sounds useful. How do I do that? Sub just_four_lines() Dim rs As Object Set rs = CreateObject("ADOR.Recordset") rs.Open _ "SELECT COUNT(*) as customer_count," & _ " Country FROM MyFile#csv" & _ " GROUP BY Country" & _ " ORDER BY COUNT(*), Country", _ "Provider=Microsoft.Jet.OLEDB.4.0;" & _ "Data Source=C:\MyFolder\;" & _ "Extended Properties='Text;HDR=Yes';" Sheet1.Range("A1").CopyFromRecordset rs End Sub For more details <g, see: http://msdn.microsoft.com/library/de...ng03092004.asp Jamie. -- |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
List Box with lookup facility | Excel Worksheet Functions | |||
Is there a 'floating key/ legend' facility? | Excel Discussion (Misc queries) | |||
Spelling Facility | New Users to Excel | |||
how do i use LOTUS combine facility in Excel | Excel Discussion (Misc queries) | |||
search facility | Excel Programming |