Anda di halaman 1dari 5

8/16/2017 How to use parameterized query in Excel using column as parameter?

- Stack Overflow

I would use a parameterized query (where IDVALUE=?), but that prompts me to input the parameter
value

From what you mentioned I under stand you are using MS Query and you need to follow the following
steps

Steps to make a parameterized query in Excel use a cell value as parameter

1. First go to the Data tab in Excel and Select MS Query under External Data Sources

2. A pop up appears asking you to choose data source. Select the data source or add a new data
source and select it. Make sure to uncheck Use the query wizard to create or edit queries it is
not very useful in most cases

3. Then a pop up appears asking you to add table select any table for now. It is better to select a table
with less rows.

https://stackoverflow.com/questions/26413092/how-to-use-parameterized-query-in-excel-using-column-as-parameter 1/5
8/16/2017 How to use parameterized query in Excel using column as parameter? - Stack Overflow

4. Then a Query window appears with the table you have selected and its data

5. Then click on the view menu and uncheck tables . This removes the graphically representation in
query window and makes it easier to alter you sql query

6. Click on the SQL button below the format menu in query window. A pop up comes where you can
edit the query as you wish. Make sure to add question mark(s) for the parameter(s) you want.

https://stackoverflow.com/questions/26413092/how-to-use-parameterized-query-in-excel-using-column-as-parameter 2/5
8/16/2017 How to use parameterized query in Excel using column as parameter? - Stack Overflow

7. Then a pop up appears ask you for parameter value(s) enter some valid value for now

8. Then the query window shows the result of query based on the parameter entered

9. Click on the exit button below the view menu in query window. Then the query window closes and
Import Data pop up comes asking where in excel to display the result. Choose accordingly

https://stackoverflow.com/questions/26413092/how-to-use-parameterized-query-in-excel-using-column-as-parameter 3/5
8/16/2017 How to use parameterized query in Excel using column as parameter? - Stack Overflow

10. Then click on Properties button on left before you click OK. A new pop up appears with the default
usage tab selected.

11. Make any changes needed in this tab and click on Definition tab. Click on Parameters button in
bottom of the pop up next to edit query button

https://stackoverflow.com/questions/26413092/how-to-use-parameterized-query-in-excel-using-column-as-parameter 4/5
8/16/2017 How to use parameterized query in Excel using column as parameter? - Stack Overflow

12. Parameters pop up comes displaying the parameters used in the query. Here you must select
the Get the value from following cell radio button to select the value of cell as the parameter for
the query. Click OK and you should be done.

This method is for people with no VBA experience. If you know VBA then refer to this answer to achieve
the something similar using VBA.

https://stackoverflow.com/questions/26413092/how-to-use-parameterized-query-in-excel-using-column-as-parameter 5/5

Anda mungkin juga menyukai