【问题标题】:Using Query in Google Sheets, how display a pair only once?在谷歌表格中使用查询,如何只显示一次?
【发布时间】:2019-07-14 23:28:21
【问题描述】:

我正在尝试将一对分组并显示一次。 一对可以以多种方式出现,并且当前针对每种不同的出现显示。

删除了骰子的坏例子。

我的实际问题比下面的例子更复杂,但这是为了创建一个简单/简短的数据集。

繁花组合:https://docs.google.com/spreadsheets/d/1-Kkr3P3_LRhFcmhNpf3JJwo5aXu1fp11muRBUxmShKU/edit?usp=sharing

完成单元格输入以完成所需的输出:(工作表中的F26)

    ={"Can be produced by:"\ "And:"\ "Entries:";
    ARRAYFORMULA(QUERY(IF(D3:D=F4; IF(C3:C<B3:B; {C3:C\ B3:B}; {B3:B\ C3:C}); 
    ); 
    "select Col2,Col1,count(Col1) 
    where Col1 is not null
    group by Col1,Col2
    order by count(Col1) desc
    label count(Col1)''"; 0))}

【问题讨论】:

  • 当然@player0,我将URL添加到工作表的一个小子集示例副本。

标签: google-sheets google-sheets-formula array-formulas google-sheets-query google-query-language


【解决方案1】:
={A1:C1;
 ARRAYFORMULA(QUERY(IF(C:C=6, IF(A:A<B:B, {A:A, B:B}, {B:B, A:A}), ), 
 "select Col1,Col2,count(Col1) 
  where Col1 is not null
  group by Col1,Col2
  label count(Col1)''", 0))}


={"Can be produced by:"\ "And:"\ "Entries:";
 ARRAYFORMULA(QUERY(IF(D3:D=F4; IF(C3:C<B3:B; {B3:B\ C3:C}; {C3:C\ B3:B}); ); 
 "select Col1,Col2,count(Col1) 
  where Col1 is not null
  group by Col1,Col2
  order by count(Col1) desc
  label count(Col1)''"; 0))}

【讨论】:

  • 哦,将它放在数组公式中很有趣。是你使用空标签复制所有标签吗?
  • @BjörnNevitarJohansson 不确定您在问什么,但请查看更新后的答案
  • 啊,谢谢。将尝试更新的答案,看看我是否可以让它工作
  • 纯粹!向此示例添加了排序,并为输出切换了第 1 列和第 2 列。正是我想要的!
猜你喜欢
  • 2019-08-23
  • 1970-01-01
  • 2021-07-09
  • 1970-01-01
  • 1970-01-01
  • 2020-11-07
  • 2017-05-10
  • 1970-01-01
相关资源
最近更新 更多