gpt4 book ai didi

arrays - 给定一组数据,是否有一种简单的方法可以找到多个标题列?

转载 作者:行者123 更新时间:2023-12-04 07:20:30 25 4
gpt4 key购买 nike

我有一张看起来像这样的表:
enter image description here
我想要一个公式来查询 A2:E7 中的数据并从 A1:E1 中提取相应的列标题。诀窍是值可能会出现多次。
示例结果如下所示:
enter image description here
示例表:https://docs.google.com/spreadsheets/d/1Zr_q8nwYPixUjxWYdT-WlQLiGIUzqoK_cSQXSp19nJg

最佳答案

用:

=ARRAYFORMULA(IFERROR(TRIM(SPLIT(IFNA(VLOOKUP(G1:G, 
SPLIT(FLATTEN(QUERY(TRANSPOSE(QUERY(QUERY(UNIQUE(SPLIT(FLATTEN(
IF(A2:E="",,A2:E&"♂×"&A1:E1&"♀×"&A1:E1)), "×")),
"select Col1,max(Col2)
where Col2 is not null
group by Col1
pivot Col3"),
"offset 1", 0)),,9^9)), "♂"), 2, 0)), "♀"))))
enter image description here

更新:
=ARRAYFORMULA(ARRAY_CONSTRAIN(IFERROR(TRIM(SPLIT(IFNA(VLOOKUP(G1:G, 
SPLIT(FLATTEN(QUERY(TRANSPOSE(QUERY(QUERY(UNIQUE(SPLIT(FLATTEN(
IF(A2:E="",,A2:E&"♂×"&A1:E1&"♀×"&A1:E1)), "×")),
"select Col1,max(Col2)
where Col2 is not null
group by Col1
pivot Col3"),
"offset 1", 0)),,9^9)), "♂"), 2, 0)), "♀"))), 9^9, 2))
enter image description here

关于arrays - 给定一组数据,是否有一种简单的方法可以找到多个标题列?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/68535724/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com