Importrange usage to maintain subset of master data from Google Sheet

时间:2018-02-22 04:30:44

标签: google-sheets spreadsheet

I have a main spreadsheet where I'm keeping the full set of my data.

  • Each row represents a patient's case
  • There is a column that has a region (NR, SR, NZ) each case has been assigned to

I would like each regional manager (eg NZ) to have their own spreadsheet (workbook) that:

  • Dynamically selects which rows in the master match that region (NZ) in the region column
  • Update the (NZ) regional spreadsheet with the rows that correspond to cases assigned to their region.

So far I understand that best function for this task is probably the importrange function:

=importrange(spreadsheet_key, range_string)

Question is how to dynamically generate the range_string - an updating range that targets all rows that match the region of interest?

Furthermore - do they have to be in the same workbook?

1 个答案:

答案 0 :(得分:1)

您可以使用echo parseString('NNLLLLLLLNNNLNLNNNN'); QUERY的组合。例如在" NZ" A2中的工作表,您可以IMPORTRANGE

只要第1列(A)中的行不为空(=QUERY(IMPORTRANGE("Main Spreadsheet URL","Sheet Name!Range"),"Select Col1, Col3, Col4 where Col1<>'' and Col4='NZ' order by Col3 asc",0)),就会将第1列(A),第3行(C)和第4行(D)中的所有行拉入新的电子表格中然后第4列(D)中的一行等于&#34; NZ&#34; (Col1<>'')然后按列3(C)(Col4=NZ)中的升序排序数据进行排序。

您也可以更换&#34; NZ&#34;在具有单元格引用的公式中,如下例所示。

order by Col3 asc