Google 工作表使用复选框限制结果跨工作表查询
Google Sheets Query across sheets using checkboxes to limit results
我正在 Google 表格中制作一个迷你搜索引擎。我有 3 sheet 秒(6 年级、7 年级、8 年级)的信息。
过去,我有一个 Combined sheet,它结合了每个 sheet 的信息。但是,当我为 1-5 年级添加额外的 sheet 时,返回的信息量将会过多。我想让用户使用复选框来确定他们想要从哪个年级获得结果。
这里是workbook。
我通过复制第 6、7 和 8 的数据为所有年级添加了 sheets。一旦我拿到它,数据的格式将是相同的。
这是我一直在研究的公式:
=iferror(If(D2=True,Query(
Kindergarten!A:I,"Select Col1,Col2,Col3,Col4,Col5,Col6,Col7,Col8 where Col9>0",
),
Query(
{Kindergarten!A:I;'1st'!A:I;'2nd'!A:I},"Select Col1,Col2,Col3,Col4,Col5,Col6,Col7,Col8 where Col9>0",
),
"No Matches, try a different search"))
您没有在“搜索”单元格中提及要搜索的内容,但公式为:
=IFERROR(QUERY({
IF(D2=TRUE, IFERROR(QUERY({Kindergarten!A:I}, "select Col1,Col2,Col3,Col4,Col5,Col6,Col7,Col8 where Col9>0", 0), {"","","","","","","",""}), {"","","","","","","",""});
IF(E2=TRUE, IFERROR(QUERY({'1st'!A:I}, "select Col1,Col2,Col3,Col4,Col5,Col6,Col7,Col8 where Col9>0", 0), {"","","","","","","",""}), {"","","","","","","",""});
IF(F2=TRUE, IFERROR(QUERY({'2nd'!A:I}, "select Col1,Col2,Col3,Col4,Col5,Col6,Col7,Col8 where Col9>0", 0), {"","","","","","","",""}), {"","","","","","","",""});
IF(G2=TRUE, IFERROR(QUERY({'3rd'!A:I}, "select Col1,Col2,Col3,Col4,Col5,Col6,Col7,Col8 where Col9>0", 0), {"","","","","","","",""}), {"","","","","","","",""});
IF(H2=TRUE, IFERROR(QUERY({'4th'!A:I}, "select Col1,Col2,Col3,Col4,Col5,Col6,Col7,Col8 where Col9>0", 0), {"","","","","","","",""}), {"","","","","","","",""});
IF(C4=TRUE, IFERROR(QUERY({'5th'!A:I}, "select Col1,Col2,Col3,Col4,Col5,Col6,Col7,Col8 where Col9>0", 0), {"","","","","","","",""}), {"","","","","","","",""});
IF(D4=TRUE, IFERROR(QUERY({'6th'!A:I}, "select Col1,Col2,Col3,Col4,Col5,Col6,Col7,Col8 where Col9>0", 0), {"","","","","","","",""}), {"","","","","","","",""});
IF(E4=TRUE, IFERROR(QUERY({'7th'!A:I}, "select Col1,Col2,Col3,Col4,Col5,Col6,Col7,Col8 where Col9>0", 0), {"","","","","","","",""}), {"","","","","","","",""});
IF(F4=TRUE, IFERROR(QUERY({'8th'!A:I}, "select Col1,Col2,Col3,Col4,Col5,Col6,Col7,Col8 where Col9>0", 0), {"","","","","","","",""}), {"","","","","","","",""});
IF(G4=TRUE, IFERROR(QUERY({'9th and 10th'!A:I}, "select Col1,Col2,Col3,Col4,Col5,Col6,Col7,Col8 where Col9>0", 0), {"","","","","","","",""}), {"","","","","","","",""});
IF(H4=TRUE, IFERROR(QUERY({'11th and 12th'!A:I}, "select Col1,Col2,Col3,Col4,Col5,Col6,Col7,Col8 where Col9>0", 0), {"","","","","","","",""}), {"","","","","","","",""})},
"where Col1 is not null", 0), "No Matches, try a different search")
我正在 Google 表格中制作一个迷你搜索引擎。我有 3 sheet 秒(6 年级、7 年级、8 年级)的信息。 过去,我有一个 Combined sheet,它结合了每个 sheet 的信息。但是,当我为 1-5 年级添加额外的 sheet 时,返回的信息量将会过多。我想让用户使用复选框来确定他们想要从哪个年级获得结果。
这里是workbook。 我通过复制第 6、7 和 8 的数据为所有年级添加了 sheets。一旦我拿到它,数据的格式将是相同的。
这是我一直在研究的公式:
=iferror(If(D2=True,Query(
Kindergarten!A:I,"Select Col1,Col2,Col3,Col4,Col5,Col6,Col7,Col8 where Col9>0",
),
Query(
{Kindergarten!A:I;'1st'!A:I;'2nd'!A:I},"Select Col1,Col2,Col3,Col4,Col5,Col6,Col7,Col8 where Col9>0",
),
"No Matches, try a different search"))
您没有在“搜索”单元格中提及要搜索的内容,但公式为:
=IFERROR(QUERY({
IF(D2=TRUE, IFERROR(QUERY({Kindergarten!A:I}, "select Col1,Col2,Col3,Col4,Col5,Col6,Col7,Col8 where Col9>0", 0), {"","","","","","","",""}), {"","","","","","","",""});
IF(E2=TRUE, IFERROR(QUERY({'1st'!A:I}, "select Col1,Col2,Col3,Col4,Col5,Col6,Col7,Col8 where Col9>0", 0), {"","","","","","","",""}), {"","","","","","","",""});
IF(F2=TRUE, IFERROR(QUERY({'2nd'!A:I}, "select Col1,Col2,Col3,Col4,Col5,Col6,Col7,Col8 where Col9>0", 0), {"","","","","","","",""}), {"","","","","","","",""});
IF(G2=TRUE, IFERROR(QUERY({'3rd'!A:I}, "select Col1,Col2,Col3,Col4,Col5,Col6,Col7,Col8 where Col9>0", 0), {"","","","","","","",""}), {"","","","","","","",""});
IF(H2=TRUE, IFERROR(QUERY({'4th'!A:I}, "select Col1,Col2,Col3,Col4,Col5,Col6,Col7,Col8 where Col9>0", 0), {"","","","","","","",""}), {"","","","","","","",""});
IF(C4=TRUE, IFERROR(QUERY({'5th'!A:I}, "select Col1,Col2,Col3,Col4,Col5,Col6,Col7,Col8 where Col9>0", 0), {"","","","","","","",""}), {"","","","","","","",""});
IF(D4=TRUE, IFERROR(QUERY({'6th'!A:I}, "select Col1,Col2,Col3,Col4,Col5,Col6,Col7,Col8 where Col9>0", 0), {"","","","","","","",""}), {"","","","","","","",""});
IF(E4=TRUE, IFERROR(QUERY({'7th'!A:I}, "select Col1,Col2,Col3,Col4,Col5,Col6,Col7,Col8 where Col9>0", 0), {"","","","","","","",""}), {"","","","","","","",""});
IF(F4=TRUE, IFERROR(QUERY({'8th'!A:I}, "select Col1,Col2,Col3,Col4,Col5,Col6,Col7,Col8 where Col9>0", 0), {"","","","","","","",""}), {"","","","","","","",""});
IF(G4=TRUE, IFERROR(QUERY({'9th and 10th'!A:I}, "select Col1,Col2,Col3,Col4,Col5,Col6,Col7,Col8 where Col9>0", 0), {"","","","","","","",""}), {"","","","","","","",""});
IF(H4=TRUE, IFERROR(QUERY({'11th and 12th'!A:I}, "select Col1,Col2,Col3,Col4,Col5,Col6,Col7,Col8 where Col9>0", 0), {"","","","","","","",""}), {"","","","","","","",""})},
"where Col1 is not null", 0), "No Matches, try a different search")