在许多 sheet 中搜索值并将结果放在一个 sheet 中

Searching many sheets for values and put the results in one sheet

我有一份员工列表,其中包含他们每个月休假的日期,这些日期当然不同,现在我想为所有休假创建一个 sheet 以展示他们全年休假的所有休假,不取决于行,而是取决于员工的姓名

我尝试使用查询,但它对我来说效果不佳,请问有什么想法吗?

Sheet link: https://docs.google.com/spreadsheets/d/1y-L5ICc-HWHYpkD_caxy2isTTHYVYCFBoCORQa5UJo4/edit#gid=833452873

我复制了您的数据库选项卡并在 A2 中输入了以下内容:

={unique({'1'!A2:A;'2'!A2:A;'3'!A2:A}),index(trim(split(transpose(query(if((index(split(flatten(query({'1'!A2:A;'2'!A2:A;'3'!A2:A}&"❄️"&{'1'!B2:C;'2'!B2:C;'3'!B2:C},"where not Col1 matches '^❄️$'")),"❄️"),,1)<>transpose(unique({'1'!A2:A;'2'!A2:A;'3'!A2:A})))+(index(split(flatten(query({'1'!A2:A;'2'!A2:A;'3'!A2:A}&"❄️"&{'1'!B2:C;'2'!B2:C;'3'!B2:C},"where not Col1 matches '^❄️$'")),"❄️"),,2)=""),,text(index(split(flatten(query({'1'!A2:A;'2'!A2:A;'3'!A2:A}&"❄️"&{'1'!B2:C;'2'!B2:C;'3'!B2:C},"where not Col1 matches '^❄️$'")),"❄️"),,2),"m/d/yyyy")),,9^9))," ")))}

不过您的日期格式不一致。有些是 d/m/yyyy 其他是 m/d/yyyy 所以你应该解决这个问题。

要么使用:

=INDEX(TRIM(SPLIT(FLATTEN(QUERY(QUERY(TEXT(IFERROR(SPLIT(FLATTEN(SUBSTITUTE(
 {'1'!A2:A;'2'!A2:A;'3'!A2:A}, " ", CHAR(13))&"×"&{'1'!B2:F;'2'!B2:F;'3'!B2:F}), "×")), {"@", "dd/mm/yyyy"}), 
 "select max(Col2) where Col2 <> '30/12/1899' group by Col2 pivot Col1"),,9^9)), " ")))


或 B2:

=INDEX(IFERROR(VLOOKUP(A2:A, TRIM(SPLIT(FLATTEN(QUERY(QUERY(TEXT(IFERROR(SPLIT(FLATTEN(SUBSTITUTE(
 {'1'!A2:A;'2'!A2:A;'3'!A2:A}, " ", CHAR(13))&"×"&{'1'!B2:F;'2'!B2:F;'3'!B2:F}), "×")), {"@", "dd/mm/yyyy"}), 
 "select max(Col2) where Col2 <> '30/12/1899' group bY Col2 pivot Col1"),,9^9)), " ")), {2,3,4,5,6}, )))