如何将包含相同值的行多次导入另一个 sheet

how to import rows that contain the same value more than once to another sheet

我有一个 session 的列表,我希望能够将已重新安排的列表(连同新的重新安排的 session)导入另一个 sheet。所以在 colC 下,一个会说 'Rescheduled',另一个会说 'Attended'。所以我想做的是获取参与者姓名,但前提是它出现不止一次,所以我会同时获得重新安排的 session 和新的 session。我尝试使用 importrange 和 query,但不太正确。我该怎么做?

https://docs.google.com/spreadsheets/d/10ZWcO9DeBx6KjiyvFvcoBlGk7yw2b8z2gFPi26orOGc/edit?usp=sharing

尝试:

=INDEX(REGEXEXTRACT(FLATTEN(QUERY(QUERY(TRANSPOSE(QUERY(TRANSPOSE(QUERY({
 IMPORTRANGE("10ZWcO9DeBx6KjiyvFvcoBlGk7yw2b8z2gFPi26orOGc", "Sheet1!A1:C"), 
 FLATTEN(QUERY(TRANSPOSE(
 IMPORTRANGE("10ZWcO9DeBx6KjiyvFvcoBlGk7yw2b8z2gFPi26orOGc", "Sheet1!A1:C")),,9^9))}, 
 "select max(Col4) where Col1 is not null group by Col2 pivot Col3")), 
 "where Col1 matches 'Rescheduled|Attended'", )), 
 "where Col1 is not null and Col2 is not null"), 
 "offset 1", )), 
 "(\d+/\d+/\d+) (.*) (Att.*|Res.*)"))

公式解释:

  • 接受 IMPORTRANGE
  • 将所有列合并为一列
  • 创建虚拟阵列{}
  • 传入 QUERY 并转换数据
  • 转置结果
  • 使用查询只获取需要的列
  • 转回
  • 比较第一列和第二列并删除
  • 删除 header 行
  • 将数据展平为一列并拆分为所需的 3 列

如果这还不够:

=INDEX(REGEXREPLACE(SORT(TEXT(REGEXEXTRACT(FLATTEN(
 QUERY(QUERY(TRANSPOSE(QUERY(TRANSPOSE(QUERY({
 IMPORTRANGE("10ZWcO9DeBx6KjiyvFvcoBlGk7yw2b8z2gFPi26orOGc", "Sheet1!A1:C"), 
 FLATTEN(QUERY(TRANSPOSE(
 IMPORTRANGE("10ZWcO9DeBx6KjiyvFvcoBlGk7yw2b8z2gFPi26orOGc", "Sheet1!A1:C")),,9^9))}, 
 "select max(Col4) where Col1 is not null group by Col2 pivot Col3")), 
 "where Col1 matches 'Rescheduled|Attended'", )), 
 "where Col1 is not null and Col2 is not null"), 
 "offset 1", )), 
 "(\d+/\d+/\d+) (.*) (Att.*|Res.*)"), {
 "yyyymmdd\×m/d/yyyy", "@", "@"}), 2, 0, 1, 1), "^(\d+×)", ))

demo sheet