按 C 列排序,但将 F 列中的值分组
Sort by Column C but group the values from Column F
为简单起见,我希望它按国家/地区分开(写在C列名称的开头),但是F列有数据的留在一起,没有数据的是分开了。
=QUERY(Sheet7!B1:G,"Where C is not null Order by C")
In the country Brazil it is noted that the lines with values in F are
not grouped. This is what I would like to group together, in
alphabetical order as in Column C, but in the list of each country
came first those with data in Column F.
我尝试在引用成员 (Player0) 后使用 Query with Group by,这是问题的第一个答案,但不幸的是我无法得到我需要做的事情。
正确的方法是:
如果你想使用 group by
那么你总是需要使用一些聚合函数,例如:
- 总和
- 平均
- 最大值
- 分钟
- 计数
例如:
=QUERY(Sheet7!B1:G, "select C,count(C) where C is not null group by F order by C")
其实没有聚合是不能用group by的,所以我修改你的公式:
=QUERY(Sheet7!B1:G,"select min(B), min(C), min(D), min(E), F Where C is not null Group By F Order by min(C) label min(B) '', min(C) '', min(D) '', min(E) ''")
解释:
1. min(B), min(C), min(D), min(E) or max(B), max(C), max(D), max(E),
just as some aggregates, because you group the query by F
2. label min(B) '', min(C) '', min(D) '', min(E) ''", to not use title
或者如果不需要聚合,可以使用排序公式
Filter(sort(Sheet7!B1:G,5,true, 2, true),Sheet7!C1:C<>"")
此处结果将对国家和 F 进行排序:
= array_constrain
( arrayformula
( query
( SORT
( { Sheet7!B1:G,
mid (Sheet7!C1:C,1,find("/",Sheet7!C1:C,find("/",Sheet7!C1:C,2)+1)),
Sheet7!F1:F
}
, 7, true, 8, true
)
,"Select *"
)
)
,ROWS(Sheet7!B1:B),6
)
为简单起见,我希望它按国家/地区分开(写在C列名称的开头),但是F列有数据的留在一起,没有数据的是分开了。
=QUERY(Sheet7!B1:G,"Where C is not null Order by C")
In the country Brazil it is noted that the lines with values in F are not grouped. This is what I would like to group together, in alphabetical order as in Column C, but in the list of each country came first those with data in Column F.
我尝试在引用成员 (Player0) 后使用 Query with Group by,这是问题的第一个答案,但不幸的是我无法得到我需要做的事情。
正确的方法是:
如果你想使用 group by
那么你总是需要使用一些聚合函数,例如:
- 总和
- 平均
- 最大值
- 分钟
- 计数
例如:
=QUERY(Sheet7!B1:G, "select C,count(C) where C is not null group by F order by C")
其实没有聚合是不能用group by的,所以我修改你的公式:
=QUERY(Sheet7!B1:G,"select min(B), min(C), min(D), min(E), F Where C is not null Group By F Order by min(C) label min(B) '', min(C) '', min(D) '', min(E) ''")
解释:
1. min(B), min(C), min(D), min(E) or max(B), max(C), max(D), max(E),
just as some aggregates, because you group the query by F
2. label min(B) '', min(C) '', min(D) '', min(E) ''", to not use title
或者如果不需要聚合,可以使用排序公式
Filter(sort(Sheet7!B1:G,5,true, 2, true),Sheet7!C1:C<>"")
此处结果将对国家和 F 进行排序:
= array_constrain
( arrayformula
( query
( SORT
( { Sheet7!B1:G,
mid (Sheet7!C1:C,1,find("/",Sheet7!C1:C,find("/",Sheet7!C1:C,2)+1)),
Sheet7!F1:F
}
, 7, true, 8, true
)
,"Select *"
)
)
,ROWS(Sheet7!B1:B),6
)