如何在 Google Sheet 范围 row-by-row 中搜索与另一个 sheet 上的 header 的匹配项,然后将行的第一个单元格添加到 header?

How can I search a Google Sheet range row-by-row for matches to headers on another sheet and then add the first cell of the row under the header?

我在这里制作了我的 google sheet 模型:https://docs.google.com/spreadsheets/d/1u5wlCjSdZOYdAs0V-WKGK8KYcZ7p80OJReTasTK3oH4/edit?usp=sharing。 (我的实际数据由 90 列和 60 行组成。)

我想搜索范围数据!B2:M6 row-by-row 寻找与公式的匹配项!A1:L1 并且,例如,如果与公式匹配!A$1 在范围数据中找到!B2 :M2,我要data!$A2放在A列第一个空space等

非常感谢您的帮助。

附录:一个并发症也很好解决。一些数据不完全匹配,缺少最后一个字符(所以它是 Chemistr 而不是 Chemistry)。

尝试:

=INDEX(IFERROR(HLOOKUP(A19:L19, TRANSPOSE(SPLIT(FLATTEN(QUERY(QUERY(SPLIT(FLATTEN(
 IF(data!B2:M="",,data!B2:M&"×"&data!A2:A)), "×"), 
 "select max(Col2) where Col2 is not null group by Col2 pivot Col1"),,9^9)), " ")), 
 {2; 3; 4; 5; 6}, 0)))