Excel Microsoft Query Parameter

Excel Microsoft Query Parameter Rating: 7,3/10 2361 votes
Active4 years, 1 month ago
  1. Excel Microsoft Query Multiple Parameters
  2. Excel Microsoft Query Too Few Parameters Expected 1
  3. Excel Microsoft Query Parameters Greyed Out

If you have more basic usage questions with Microsoft Excel. I am trying to use parameters in a SQL query for an external data connection. However the Parameter. Steps to make a parameterized query in Excel use a cell value as parameter First go to the Data tab in Excel and Select MS Query under External Data Sources A pop up appears asking you to choose data source. Select the data source or add a new data source and select it.

I'm using MS Excel to get data from a MySQL database through ODBC.
I successfully get data using an SQL query. But now I want that query to be parameterized.
So I wonder If it is possible to use a cell value (a spreadsheet cell) as a parameter for such a query.
For example, for this query:

I'd like to get the id value from, say, cell D4 in the spreadsheet.

Is that the proper approach to parameterize a query? and how can I do it?

Thanks.

GetFreeGetFree
24.3k16 gold badges62 silver badges87 bronze badges

4 Answers

I had the same problem as you, Noboby can understand me, But I solved it in this way.

you need insert a parameter in other sheet, the SQL will consider that information like asdatabase, then you can select the information and compare them into parameter you like.

Server

GetFree
24.3k16 gold badges62 silver badges87 bronze badges
JoaquimJoaquim

If you are using microsoft query, you can add '?' to your query..

Microsoft

Free vba pokemon games download. select name from user where id= ?

that will popup a small window asking for the cell/data/etc when you go back to excel.

In the popup window, you can also select 'always use this cell as a parameter' eliminating the need to define that cell every time you refresh your data. This is the easiest option.

Community
pojomxpojomx
5502 gold badges9 silver badges24 bronze badges
barrowc

Excel Microsoft Query Multiple Parameters

barrowc
8,9531 gold badge28 silver badges45 bronze badges

The SQL is somewhat like the syntax of MS SQL.

Excel Microsoft Query Too Few Parameters Expected 1

It is important that the table name is ended with a $ sign and the whole thing is put into brackets. As conditions you can use any value, but so far Excel didn't allow me to use what I call 'SQL Apostrophes' (´), so a column title in one word is recommended.

If you have users listed in a table called 'Users', and the id is in a column titled 'id' and the name in a column titled 'Name', your query will look like this:

Hope this helps.

Kat SeikoKat Seiko

protected by Robert LongsonAug 24 '15 at 17:33

Thank you for your interest in this question. Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).
Would you like to answer one of these unanswered questions instead?

Excel Microsoft Query Parameters Greyed Out

Not the answer you're looking for? Browse other questions tagged excelodbc or ask your own question.