Google Sheets:用于汇总文本连接数组的Arrayformula(查询/过滤器...)
我在 Google 表格中使用 Arrayformula 汇总单个单元格中的列值时遇到问题。
我做了一个简单的例子,说明我的数据(大约)是什么样子以及我想如何总结它。 在表1中,您可以看到project_members填充在不同的项目中。 表 2 显示了我想要如何可视化我的数据。在 D 列中列出了唯一的 project_ids,到目前为止一切顺利。现在我希望 E 列显示每个成员都参与了我可以在他们旁边找到的项目。
[示例][1] [1]:https://i.sstatic.net/1v1mk.png
我已经设法使用这个得到我想要的东西:
=TEXTJOIN(" , ";1;FILTER(B:B;A:A=D2))
或
=TEXTJOIN(" , ";1;QUERY(A:D;"Select B where A contains '"& D2 &"' ";0))
现在我的实际数据集比这个示例大得多并且数据正在不断添加。这就是为什么我需要将 E 列中的公式自动化。 我已经尝试过这个:
=ARRAYFORMULA(TEXTJOIN(" , ";1;QUERY(A:D;"Select B where A contains '"& D:D &"' ";0)))
但这不起作用。 我很感谢您的帮助!
I have a problem in Google Sheets summarizing values from a column in one single cell using an Arrayformula.
I made an easy example how my data looks like (approximately) and how I want to summarize it.
In table1 you can see project_members stuffed on different projects.
Table2 shows how I want to visualize my data. In column D the unique project_ids are listed, so far so good. Now I want column E to show every member stuffed on the project I can find next to them.
[Example][1]
[1]: https://i.sstatic.net/1v1mk.png
I have managed to get what I want using this:
=TEXTJOIN(" , ";1;FILTER(B:B;A:A=D2))
or
=TEXTJOIN(" , ";1;QUERY(A:D;"Select B where A contains '"& D2 &"' ";0))
Now my actual dataset is way bigger than this example and data is beeing added constantly. This is why I need the formula in column E to be automated.
I have tried this:
=ARRAYFORMULA(TEXTJOIN(" , ";1;QUERY(A:D;"Select B where A contains '"& D:D &"' ";0)))
But that doesnt work.
I´m thankful for help!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
解决方案
尝试这个独特的数组公式,它将考虑添加的行(德语表示法)
有关构造的解释,
最重要的步骤是在 D2 中(美国notation)
=arrayformula(if(A2:A10=transpose(unique(A2:A10)),B2:B10,))
,然后应用 query(,,9*9) 收集所有项目每列solution
Try this unique arrayformula that will take into account added lines (German Notation)
explanation about the construction
the most important step is in D2 (US notation)
=arrayformula(if(A2:A10=transpose(unique(A2:A10)),B2:B10,))
, then apply query(,,9*9) to gather all items in each column请参阅我新添加的工作表(“Erik Help”)和此公式:
=ArrayFormula({A1:B1;REGEXREPLACE(TRIM(SPLIT(FLATTEN(QUERY(QUERY({A2:A&"~"\B2: B&","}; "选择 MAX(Col2),其中 Col2 不为 NULL GROUP BY Col2 PIVOT Col1"); 9^9));"~"));"[,\s]+$";"")})
这个公式很复杂,所以我邀请有兴趣的人把它拆开并放在它重新组合在一起以供理解。
See my newly added sheet ("Erik Help") and this formula there:
=ArrayFormula({A1:B1;REGEXREPLACE(TRIM(SPLIT(FLATTEN(QUERY(QUERY({A2:A&"~"\B2:B&","}; "Select MAX(Col2) where Col2 IS NOT NULL GROUP BY Col2 PIVOT Col1");; 9^9));"~"));"[,\s]+$";"")})
This formula is complex, and so I invite anyone who is interested to take it apart and put it back together for understanding.