Excel – Embed microsoft query in excel with multiple parameters from spreadsheet

microsoft excelmicrosoft-excel-2007parametersquerysql

I am trying to embed a microsoft query within an excel spreadsheet, that passes several parameters from the spreadsheet to the query. I would like the microsoft excel query function to find a few values in cells on the worksheet and pass them into the SQL code. I used this approach, but I could only understand how to pass a single parameter using the ?. I would like to pass about 3 or 4 parameters, and some of them are used in multiple places in the query. The query doesn't seem to be editable using the query builder in ms query so I wrote it in sql using a text editor.

Note: other than SQL select queries, I'm not much of a programmer so if there is a point and click way to do this (i.e. something that does not require visual basic) that would be especially helpful.

Best Answer

You can try this in SQL view, then Excel will prompt you to select the referring cells:

where (CustomerID = ?) AND (xxx = ?) AND (zzz = ?)