【问题标题】:How do I find the most common value in more than one column?如何在多列中找到最常见的值?
【发布时间】:2019-11-16 20:57:57
【问题描述】:

当给定多个列或行时,是否有一个公式可以返回该范围内最常见的值?示例:

在上面的示例中,给定列 A 和 B,公式将返回 Bird,因为 Bird 出现 4 次,比任何其他值都多。

【问题讨论】:

    标签: google-sheets google-sheets-formula counting google-sheets-query google-query-language


    【解决方案1】:

    尝试:

    =INDEX(QUERY({A:A; B:B}, 
     "select Col1,count(Col1) 
      group by Col1 
      order by count(Col1) desc"), 2, 1)
    

    【讨论】:

    • 太棒了!谢谢!最后一个问题:有没有办法用这个省略某些值?这样它会忽略部分数据?例如:告诉它忽略上面例子中的鸟。
    • 确定:=INDEX(QUERY({A:A; B:B}, "select Col1,count(Col1) where not lower(Col1) = 'bird' group by Col1 order by count(Col1) desc"), 2, 1)
    • 太棒了。再次感谢您!
    猜你喜欢
    • 2021-10-09
    • 2021-09-22
    • 2012-08-31
    • 1970-01-01
    • 2012-08-27
    • 2012-11-12
    • 2016-11-16
    • 2017-04-21
    相关资源
    最近更新 更多