【发布时间】:2020-10-20 16:40:38
【问题描述】:
我有一个类似上述链接的谷歌表格,看起来像这样
Timestamp Exact Username of Hacker Video Link
6/30/2020 1:55:21 Column1DummyData
6/30/2020 1:59:09 Column1DummyData
6/30/2020 1:59:14 Column1DummyData
6/30/2020 1:59:19 Column1DummyData
6/30/2020 2:59:31 Svd
6/30/2020 2:59:37 Svd
6/30/2020 10:38:15 qwerty
6/30/2020 10:44:15 test https://www.youtube.com/watch?v=3UZzu4UQLcI
6/30/2020 10:58:53 test https://www.youtube.com/watch?v=HbgzrKJvDRw
6/30/2020 10:59:33 test https://www.youtube.com/watch?v=gxpX_mubz2A
我设法使用查询做出了这样的输出:
*=ARRAYFORMULA({
QUERY(B3:B, "select B,count(B) where B !='' group by B label count(B)''"), IFNA(VLOOKUP(
QUERY(B3:B, "select B,count(B) where B !='' group by B label count(B)''"), {
QUERY(B3:C, "select B,count(B) where B !='' and C !='' group by B label count(B)''"),
REGEXREPLACE(TRIM(TRANSPOSE(QUERY(TRANSPOSE(IF(QUERY(
QUERY(B3:C, "select count(B) where B !='' and C !='' group by B pivot C"),
"offset 1", 0)="",,QUERY(
QUERY(B3:C, "select count(B) where B !='' and C !='' group by B pivot C"),
"limit 0", 1)&",")),,99^99))), ",$", )}, 3, 0))})*
输出
Name NumberOfItem Video link
Column1DummyData 4
Svd 2
qwerty 1
test 3 https://www.youtube.com/watch?v=3UZzu4UQLcI, https://www.youtube.com/watch?v=HbgzrKJvDRw, https://www.youtube.com/watch?v=gxpX_mubz2A
但我需要根据 NumberOfItem 列按降序对输出进行排序
【问题讨论】:
-
你不能在
ARRAYFORMULA之外再放一个QUERY并使用order by参数对其进行排序吗? -
其实昨天是我有生以来第一次使用Excel。输入东西。所以这对我来说很困惑。
-
=QUERY(ARRAYFORMULA({ QUERY(B3:B, "select B,count(B) where B !='' group by B label count(B)''"), IFNA(VLOOKUP ( QUERY(B3:B, "select B,count(B) where B !='' group by B label count(B)''"), { QUERY(B3:C, "select B,count(B) where B !='' and C !='' group by B label count(B)''"), REGEXREPLACE(TRIM(TRANSPOSE(QUERY(TRANSPOSE(IF(QUERY( QUERY(B3:C, "select count(B)其中 B !='' and C !='' group by B pivot C"), "offset 1", 0)="",,QUERY( QUERY(B3:C, "select count(B) where B != '' and C !='' group by B pivot C"), "limit 0", 1)&",")),,99^99))), ",$", )}, 3, 0) )}),"按 Col2 desc 排序",-1)
-
@a-burge 非常感谢它确实有效
标签: google-sheets google-sheets-formula array-formulas google-sheets-query gs-vlookup