It's difficult to envision why you would merge entire columns A:B, since that would essentially just create one column; so I'm guessing that only the header columns are merged. If that is the case, there is a simple solution: include at least five blank columns from Data! in your QUERY.
For instance, if you only had data in Data!A:E (i.e., F and following are blank), you could structure your QUERY in Query!A1 like this:
=QUERY(Data!A:J,"Select A, F, B, G, C, H, D, I, E, J Limit 100")
Notice that the Select calls filled column, empty column, filled column, empty column, etc.
However... if you were merging header columns in Query! and trying to fill the left-hand column under each merged header while leaving the right-hand column under each header free to add new data, this approach will not work, since you can't add manual data anywhere inside the scope of a QUERY-filled range.
In that case, the simple solution is simply to place five separate QUERY calls:
In A1: =QUERY(Data!A:A,"Select * Limit 100")
In C1: =QUERY(Data!B:B,"Select * Limit 100")
In E1: =QUERY(Data!C:C,"Select * Limit 100")
In G1: =QUERY(Data!D:D,"Select * Limit 100")
In I1: =QUERY(Data!E:E,"Select * Limit 100")
Best Answer
You can generate a comma-separated string of column names with a formula such as
(here C:F is the example of a range of columns). The above formula returns the string C,D,E,F which is suitable for use in a query. Optionally, the
arrayformula
part can go outside. Example:For a short range like C:F this obviously isn't worth the effort, but if you have something like
M:AT
, then it's probably going to save time.Explanation
column
returns a column numberaddress
returns A1 notation of the cell at the top of that column (option 4 means no $ will be used)substitute
removes row number 1join
joins by commas