1

I'm using the following query to pull data from one sheet into another.

=query(data!B2:CL,"select B, C, D, E, F, G, H, I, J, BB, BZ, CA, BA where J = 'Industry Certification'",false)

The above query works perfectly. However, if I change 'BB' to 'BY'. I get the following error.

Error

Unable to parse query string for Function QUERY parameter 2: PARSE_ERROR: Encountered "BY" at line 1, column 35. Was expecting one of: "true" ... "false" ... "date" ... "timeofday" ... "datetime" ... "timestamp" ... "min" ... "max" ... "avg" ... "count" ... "sum" ... "no_values" ... "no_format" ... "is" ... "null" ... "year" ... "month" ... "day" ... "hour" ... "minute" ... "second" ... "millisecond" ... "with" ... "contains" ... "starts" ... "ends" ... "matches" ... "like" ... "now" ... "dateDiff" ... "quarter" ... "lower" ... "upper" ... "dayOfWeek" ... "toDate" ... ... ... ... ... ... "(" ... "-" ...

The value of cell 'BY' is a simple string (activities).

I'm scratching my head confused. Any help is greatly appreciated.

2

Short answer

According to the documentation, BY is a reserved word, to use it as an identifier, it should be back-quoted.

Explanation

I think that it's a reserved word because it's used by two clauses:

  • I don't get the error when backquoted, but I also don't get the data from column BY. The rest of the QUERY data does appear. Any suggestions for getting the data from BY to appear? – Mr. B Jan 6 '17 at 21:22
1

use ` instead of ' like:

=QUERY(data!B2:CL, "select B, C, D, E, F, G, H, I, J, `BY`, BZ, CA, BA 
                    where J = 'Industry Certification'", 0)

3

-1

Something seems to have changed (recently) in google, and this solution is no longer working. Does anyone have tips on how to indicate in a formula that we're referring to the column BY instead of using it as an indicator?

New contributor
Jill Battal is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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