简体   繁体   English

Excel具有多个条件的计数

[英]Excel Count with multiple conditions

I have a table with initial public offerings of companies from 1970 until 2008. These companies are part of different industries based on SIC indentifier codes (for example 3144 for a specific manufacturing industry). 从1970年到2008年,我有一张公司首次公开发行的表格。这些公司是基于SIC标识码的不同行业的一部分(例如特定制造业的3144)。 A company can operate in up to 39 industries (so 39 columns with an identifier) 一家公司最多可以在39个行业中运营(因此39列带有标识符)

I now want to create a table where I count the number of initial public offerings based on the year of the offering and the company being in a specific industry (so for example count all IPOs in 1975 in the 3144 code). 我现在想创建一个表格,根据发行年份和公司在特定行业中计算首次公开发行的数量(例如,计算1975年3144代码中的所有首次公开募股)。 Its works with Countif but the formula gets super long because for the SIC code conditions I need 38 OR formulas to say that the SIC code can lie in any of the 39 columns. 它与Countif一起使用,但公式变得超长,因为对于SIC代码条件,我需要38个OR公式来表示SIC代码可以位于39列中的任何一列中。

Is there a faster way? 有更快的方法吗?

Thank you for your help. 谢谢您的帮助。

OK, I'm assuming you have the year in column A and then SIC codes anywhere in columns B to AN 好的,我假设您在A列中有年份,然后在B到AN列的任何地方都有SIC代码

Try using SUMPRODUCT like this to count 3144 in 1975 尝试使用像这样的SUMPRODUCT在1975年计算3144

=SUMPRODUCT((A2:A1000=1975)*(B2:AN1000=3144))

Assumes up to 1000 rows of data, change as required 假设最多1000行数据,根据需要进行更改

You may need quotes arounnd "3144" in the formula if those columns are text formatted 如果这些列是文本格式,则公式中可能需要引用“3144”

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

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