Embed microsoft query in excel with multiple parameters from spreadsheet

5,311

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

where (CustomerID = ?) AND (xxx = ?) AND (zzz = ?)
Share:
5,311

Related videos on Youtube

Doug
Author by

Doug

Updated on September 18, 2022

Comments

  • Doug
    Doug almost 2 years

    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.

    • Breakthrough
      Breakthrough almost 13 years
      This is very trivial to do with VBA. Without it, I'm not sure how unfortunately.