Please help about SQL in Excel...

B

Boris

Dear Group...

How can I retrieve some data from Sheet2 to Sheet1 with SQL specific query ?

For example I have Col1 and Col2 in Sheet1 and want to display Col3 which is
column from sheet2 with specific condition (where, order by etc.etc.)?

How ?

Thanks

Boris
 
A

Arvi Laanemets

Hi

To create a query from Excel table (in same, or in other workbook), using MS
Query wizard:

a) create simple named range from your source data (headers included);
b) save the source workbook;
c) start MS Query wizard. The source workbook will be the datasource, and
named range(s) is/are table(s);
d) after you are asked for destination for result data, you can set the data
range properties - my advice is that you set old data to be written over,
and unused cvells to be cleared (not deleted).


But you have to consider, that returned data don't depend in any way from
data in other columns. Probably the better solution for your task are
worksheet functions (but to advice something more info is needed).
 
A

Andy Wiggins

This file might be a help:
http://www.bygsoftware.com/examples/zipfiles/UsingSqlRequest.zip
It's in the "Excel with Access Databases" section on page:
http://www.bygsoftware.com/examples/examples.htm

This workbook demonstrates how to get data direct from an MS Access table,
or from an open or closed MS Excel workbook using the workbook function
SQL.REQUEST.

Recently updated to show the use of SQL.REQUEST in the same workbook.

The code is open and commented.


--
Regards
-
Andy Wiggins FCCA
www.BygSoftware.com
Excel, Access and VBA Consultancy
 
B

Boris

Thank you very much for your answer...

Boris


Arvi Laanemets said:
Hi

To create a query from Excel table (in same, or in other workbook), using
MS
Query wizard:

a) create simple named range from your source data (headers included);
b) save the source workbook;
c) start MS Query wizard. The source workbook will be the datasource, and
named range(s) is/are table(s);
d) after you are asked for destination for result data, you can set the
data
range properties - my advice is that you set old data to be written over,
and unused cvells to be cleared (not deleted).


But you have to consider, that returned data don't depend in any way from
data in other columns. Probably the better solution for your task are
worksheet functions (but to advice something more info is needed).
 

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