我需要返回的查询 Sheet_1
A | B | C
1 | 2 | 3
4 | 5 | 6
Sheet_2
D | E | F | G | H | I |
0 | 1 | 2 | 3 | 4 | 5 |
6 | 7 | 8 | 9 | 0 | 1 |
2 | 3 | 4 | 5 | 6 | 7 |
8 | 9 | 0 | 1 | 2 | 3 |
4 | 5 | 6 | 7 | 8 | 9 |
0 | 1 | 2 | 3 | 4 | 5 |
加入结果
A | B | C | D | E | F | G | H | I |
1 | 2 | 3 | 0 | 1 | 2 | 3 | 4 | 5 |
4 | 5 | 6 | 6 | 7 | 8 | 9 | 0 | 1 |
| | | 2 | 3 | 4 | 5 | 6 | 7 |
| | | 8 | 9 | 0 | 1 | 2 | 3 |
| | | 8 | 9 | 0 | 1 | 2 | 3 |
| | | 4 | 5 | 6 | 7 | 8 | 9 |
| | | 0 | 1 | 2 | 3 | 4 | 5 |
在Google表格中可以使用query
和importrange
吗?
答案 0 :(得分:0)
使用:
=QUERY({Sheet_1!A1:C100, Sheet_2!D1:I100}, "where Col4 is not null", 0)
在您的情况下,您将需要3种类型的公式,因为您的数据集不够统一。因此,请创建一个新的电子表格,并使用IMPORTRANGE
公式在单独的工作表中导入所有市场:
然后创建一个主表,您将在其中合并来自所有市场的所有数据
在 A1 单元格粘贴中:
=ARRAYFORMULA({market1!A1:J2, TRANSPOSE(QUERY(TRANSPOSE({
market1!K1:2, market2!K1:2}), "where Col2 is not null", 0))})
在 A3 单元格粘贴中:
=QUERY({market1!A3:J; market2!A3:J}, "where Col2 is not null", 0)
,然后将其粘贴到 K3 单元格中,并将其拖动到右侧:
=ARRAYFORMULA(IFERROR(VLOOKUP($B3:$B, QUERY({
market1!$B3:$B, IFERROR(INDIRECT("market1!"&ADDRESS(3, MATCH(K1, market1!$A1:1, 0), 4)&":"&ADDRESS(ROWS(market1!$A:$A), MATCH(K1, market1!$A1:1, 0), 4)), REGEXREPLACE(market1!$B3:$B,".*",));
market2!$B3:$B, IFERROR(INDIRECT("market2!"&ADDRESS(3, MATCH(K1, market2!$A1:1, 0), 4)&":"&ADDRESS(ROWS(market2!$A:$A), MATCH(K1, market2!$A1:1, 0), 4)), REGEXREPLACE(market2!$B3:$B,".*",))},
"where Col1 is not null", 0), 2, 0)))