Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Google Sheets Query Non-Contiguous Range

Is it possible to write a query (inside a formula) that references non-adjacent (discontinuous, discontiguous, I don't know the proper phrase) ranges? For instance: =query(A2:C,E2:F,"Select Col2 where Col5=3")

I want to be able to put my query in Column D, so I wanted to split the range around it. If I just say "Query(A2:F..." it will detect circular dependency when the equation is in Column D.

If it helps, I have shared a spreadsheet with an example (highlighted in yellow):

like image 344
Neill Avatar asked Dec 08 '16 21:12

Neill


People also ask

How do I select non contiguous cells in Google Sheets?

To select non-adjacent cells, simply hold down the command key (for Mac users, PC users hold down the CTRL key) while making your selections. Keep in mind this update is only available in the new Google Sheets, so consider this a great reason to upgrade your account.

How do I select non consecutive rows in Google Sheets?

Select Non-Adjacent Cells or Columns with Google Sheets Holding down the CTRL key on the keyboard and dragging over the required cells with the mouse is the only way that non-adjacent columns and cells can be selected in Google Sheets.

How do you reference non contiguous cells in Excel?

Using the Ctrl Key Holding the Ctrl key and selecting the cells is one of the best ways to select non adjacent cells in Excel.


1 Answers

Try:

=query({A2:C,E2:F},"Select Col2 where Col5=3")

or if you don't want the label use:

=query({A2:C,E2:F},"Select Col2 where Col5=3 label Col2 ''")
like image 50
Ed Nelson Avatar answered Oct 19 '22 04:10

Ed Nelson