将排序方式添加到获取唯一列表的查询公式,并从列 Google 工作表中的分隔字符串计数

add order by to query formula that gets unique list and count from delimited strings in a column Google sheets

我有一个公式可以从列中的 pipe-delimited 字符串中获取唯一的标题列表,并且计数

=ArrayFormula(QUERY(TRANSPOSE(SPLIT(JOIN("|",Elements!$H2:$H),"|")&{"";""}),"select Col1, count(Col2) group by Col1 label count(Col2) ''",0))

我需要按降序对计数进行排序,我尝试添加 order by Col2 Desc

=ArrayFormula(QUERY(TRANSPOSE(SPLIT(JOIN("|",Elements!$H2:$H),"|")&{"";""}),"select Col1, count(Col2) group by Col1 label count(Col2) order by Col2 Desc''",0))

但是我无法解析...

谢谢

使用:

=INDEX(QUERY(TRANSPOSE(SPLIT(JOIN("|", Elements!H2:H), "|")&{"";""}),
 "select Col1,count(Col2) 
  group by Col1 
  order by count(Col2) desc
  label count(Col2)''", 0))