使用Google表格中的查询,如何仅显示一对?

时间:2019-07-14 23:28:21

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

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

删除了骰子的坏例子。

我的实际问题比下面的示例复杂,但这是创建一组简单/简短的数据进行处理。

育种花的组合: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))}

1 个答案:

答案 0 :(得分: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))}

enter image description here


={"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))}

0