Can you give me a list of all the product information that we hold for these products?
As a Business Analyst, that is a fairy simple question to answer – just a matter of a couple of joins and a where-clause.
What could make it annoying and unnecessarily time-consuming, however, is the necessity to use text IDs (strings) in your where-clause. Then all of them will need to be encircled in single quotes (‘ ‘) if the query is to run.
As you can imagine, those could be quite annoying to type in for all the 300+ IDs that you need to retrieve.
A time-saving technique in such cases would be to do some pre-query prep by running the code below on your list. This will add the single quotes and the commas needed between the IDs.
|Dim Cell As Range|
|Dim IP As String|
|'written by Angelina Teneva, March 2017|
|For Each Cell In Range("A2:A" & ActiveSheet.UsedRange.Rows.Count)|
|IP = Cell.Value|
|Cell.Value = "''" & IP & "',"|
Then, all you need to do is a concatenation, which will render the IDs easy to paste in your SQL query. One handy technique to do so is to:
- move the first value to the adjacent column
- use the following formula