简体   繁体   English

计算多列中满足条件的行数

[英]Count number of rows with conditions met in multiple columns

I can use 我可以用

=COUNTIFS(range1, criteria1, range2, criteria2…) + COUNTIFS(...) etc 

Count number of rows with conditions met in two columns 计算两列中满足条件的行数

My data is such that the above will require needing approximately 150+ instances of countifs just for one cell. 我的数据是这样的,以上仅需要为一个单元格需要大约150多个countif实例。 And I need to do this for 10K or so cells. 我需要对10K左右的单元格执行此操作。 So wondering if there is another function/way to do this in a more efficient manner? 因此,想知道是否还有另一种功能/方式可以更有效地做到这一点? Example of data as follows; 数据示例如下;

1    2    10    6    
2    3    9    4                   
3    4    8    5               
7    6    7    2
4    5    1    6                  
2    1    6    7
5    6    2    8               
2    5    3    10
6    7    2    10                

And need to count how many times number 2 & 6 occur on the same row. 并且需要计算2和6在同一行上出现了多少次。

EDIT: I also need to do this with any number combination. 编辑:我还需要使用任何数字组合来执行此操作。 ie 2&6, 1&6, 5&10 etc. 即2&6、1&6、5&10等。

Thanks 谢谢

Add a column with a serial no from 1 to n. 添加一个序列号从1到n的列。

Then use a nested if: 然后在以下情况下使用嵌套:

SUM(IF(SERIAL_NO = SERIAL NO 
  IF( IF COLUMN1 =2 AND COLUMN 3 = 6,10))) AS 26

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM