-1

I recently came across this query on Google Sheets and I had a question about one of these queries:

=transpose(query(settings!A2:C,"select B, C where A = '" & B4 & "'",0))

Could some explain to me this section?

= '" & B4 & "'",0)

I am struggling to find documentation that can help explain how the ' and " work in Google Sheets queries.

TheMaster
  • 45,448
  • 6
  • 62
  • 85

1 Answers1

1

It is creating a query string using a cell value.

Say you had the word Simon in cell B4 then it is constructing

"select B, C where A = '" & B4 & "'"

as

Select B, C where A = 'Simon'

The & operator concatenates (combines) strings. Here is is adding the value of cell b4 into your where clause.

QHarr
  • 83,427
  • 12
  • 54
  • 101