Google 张 select,计数,限制
Google Sheets select, count, limit
在 Google 表格文档中,我有一列包含多个值。
我想通过计数得到前20个值,然后对其他的计数进行分组。
我现在有这个工作代码:
=QUERY(B2:B165,"select B, count(B) group by B order by count(B) desc limit 20 label B 'Pubblication venue'")
这会得到一个值在列中出现的次数,并将结果限制为 20。现在我需要其他结果的计数(大约 100)。
让我举例说明。使用我的代码,我可以获得 A、B 和 C 的计数。现在我想要其他的计数。
+-------+----+
| A | 5 |
+-------+----+
| B | 2 |
+-------+----+
| C | 4 |
+-------+----+
| Other | 90 |
+-------+----+
={QUERY(B2:B165,
"select B, count(B)
where B is not null
group by B
order by count(B) desc
limit 20
label B 'Pubblication venue'", 0);
{"Other", COUNTA(IFERROR(QUERY(QUERY(B2:B165,
"select B, count(B)
where B is not null
group by B
order by count(B) desc
offset 20
label count(B)''", 0),
"select Col1", 0)))}}
_____________________________________________________________
={QUERY(B2:B165,
"select B, count(B)
where B is not null
group by B
order by count(B) desc
limit 20
label B 'Pubblication venue'", 0);
{"Other", SUM(IFERROR(QUERY(QUERY(B2:B165,
"select B, count(B)
where B is not null
group by B
order by count(B) desc
offset 20
label count(B)''", 0),
"select Col2", 0)))}}
在 Google 表格文档中,我有一列包含多个值。 我想通过计数得到前20个值,然后对其他的计数进行分组。
我现在有这个工作代码:
=QUERY(B2:B165,"select B, count(B) group by B order by count(B) desc limit 20 label B 'Pubblication venue'")
这会得到一个值在列中出现的次数,并将结果限制为 20。现在我需要其他结果的计数(大约 100)。
让我举例说明。使用我的代码,我可以获得 A、B 和 C 的计数。现在我想要其他的计数。
+-------+----+
| A | 5 |
+-------+----+
| B | 2 |
+-------+----+
| C | 4 |
+-------+----+
| Other | 90 |
+-------+----+
={QUERY(B2:B165,
"select B, count(B)
where B is not null
group by B
order by count(B) desc
limit 20
label B 'Pubblication venue'", 0);
{"Other", COUNTA(IFERROR(QUERY(QUERY(B2:B165,
"select B, count(B)
where B is not null
group by B
order by count(B) desc
offset 20
label count(B)''", 0),
"select Col1", 0)))}}
_____________________________________________________________
={QUERY(B2:B165,
"select B, count(B)
where B is not null
group by B
order by count(B) desc
limit 20
label B 'Pubblication venue'", 0);
{"Other", SUM(IFERROR(QUERY(QUERY(B2:B165,
"select B, count(B)
where B is not null
group by B
order by count(B) desc
offset 20
label count(B)''", 0),
"select Col2", 0)))}}