Google Spreadsheets:如何在汇总函数中合并字符串 [英] Google Spreadsheets: How do you concat strings in an aggregation function

查看:53
本文介绍了Google Spreadsheets:如何在汇总函数中合并字符串的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

说我有一张桌子:

A, 1
B, 1
C, 2
D, 1
E, 2

如何查看第二列的表分组,并使用逗号分隔的concat函数按第一列的表聚合,即:

How do I view the table grouping by the 2nd column and aggregating by the first with a comma separated concat function ie:

1, "A,B,D"
2, "C,E"

在定义数据透视表和使用QUERY语法时,似乎唯一可用的聚合函数是诸如MIN,MAX,SUM等数字聚合.我可以定义自己的聚合函数吗?

In both defining a pivot table and using the QUERY syntax, it seems that the only aggregation functions available are numerical aggregations like MIN, MAX, SUM, etc. Can I define my own aggregation function?

推荐答案

您必须在数据透视表中添加计算字段",然后选择汇总方式>自定义".这将使公式中的列名称引用值的 array (而不是单个值).然后,您可以输入类似以下的公式:

You have to add a "Calculated Field" to the pivot table, and then select "Summarise by > Custom". This will make the column names in your formula refer to an array of values (instead of a single value). Then you can type a formula like:

= JOIN(,",MyStringColumn)

更具体地说,如果您有下表:

More specifically, if you have the following table:

使用以下配置,通过转到数据>数据透视表"来创建数据透视表.确保将汇总依据"设置为自定义"!

Create a pivot table by going to "Data > Pivot table", with the following configuration. Ensure "Summarize by" is set to "Custom"!

这篇关于Google Spreadsheets:如何在汇总函数中合并字符串的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆