Remin31
Remin31

Reputation: 11

How do I reference a non-consecutive range of columns in Google Sheets?

I am attempting to draw responses from a Google Form and filter the responses onto another sheet. However, I want to select a non-consecutive range of columns. For example, I am attempting to paste the results of Columns A through B, M through V, and X on the sheet titled 'Form Responses 1' dependent on matching the value of B1 on the current sheet to the value in the B column of 'Form Responses 1'.

'Form Responses 1' Google Sheet

I am attempting to execute the following code but it doesn't work.
query(INDIRECT('Form Responses 1'!A2:B'Form Responses 1'!M:V'Form Responses 1'!X),"Select * Where B = """&B1&""" ")

The issue is with the first parameter of the query since
query('Form Responses 1'!A2:L,"Select * Where B = """&B1&""" ")
works as I want it to, pasting columns A through L dependent on matching the value of B1 on the current sheet to the value in the B column of 'Form Responses 1'.

Do you have any suggestions? Thank you.

Upvotes: 1

Views: 2347

Answers (1)

Chris Hick
Chris Hick

Reputation: 3094

Does this formula work as you want:

=QUERY({'Form Responses 1'!A2:B,'Form Responses 1'!M2:V,'Form Responses 1'!X2:X},"where Col2 = '"&B1&"'")

Upvotes: 1

Related Questions