I have a sheet with a large table of data with a header for each column. I want to import a specific column to another sheet using the header name. I am using the below formula to do so (which has worked in the past).

=QUERY(Schedule!D:BW, "SELECT" & SUBSTITUTE(ADDRESS(1,MATCH(H1,Schedule!D1:BW1,0),4),1,""))

However I keep getting the below error and can't figure out how to solve this.

Unable to parse query string for Function QUERY parameter 2: PARSE_ERROR: Encountered " <ID> "SELECTD "" at line 1, column 1. Was expecting one of: <EOF> "select" ... "where" ... "group" ... "pivot" ... "order" ... "skipping" ... "limit" ... "offset" ... "label" ... "format" ... "options" ...

2 Answers 2


You have to place a space between SELECT and the column letter, resulting from that calculation. The error: "SELECTD " said you something :)

I think that this will solve the problem:

=QUERY(Schedule!D:BW, "SELECT " & SUBSTITUTE(ADDRESS(1,MATCH(H1,Schedule!D1:BW1,0),4),1,""))

You can cover this by transposing the dataset so the headers are in the first column, use matches / regex to match the columns you want, then transpose it back to normal

   "where Col1 matches 'Header 1|Header 2|Header 5'"))

Nothing fancy required. If you have a set list of columns you want to return (e.g. in F2:F), you can use

   "where Col1 matches '"&TEXTJOIN("|",TRUE,F2:F)&"'"))

The TEXTJOIN will generate the Header 1|Header 2|Header 3 stuff.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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