Excel中COUNTIF函数的两个条件
这个简短的Excel技巧展示了如何使用Excel的COUNTIF函数计算两个值之间的数据点的数量 。 下面列出了各种条件下,与相应的计算公式使用COUNTIF函数。 诀窍是简单地从其他减去一个条件。
要下载一个示例电子表格,其中包含这些COUNTIF公式进行了一些虚构的数据,请点击这里: COUNTIF,example.xls。 这个例子显示的公式可以做了一个小动态,通过连接条件运算符(<,<=,>,> =,<>)的单元格引用。
将包含A 列中的数据下面的公式。
条件 | 公式 |
1 <X <4 | = COUNTIF(A:A,“4”)-COUNTIF(A:A,“<= 1”) |
1 <= <4 | = COUNTIF(A:A,“4”)-COUNTIF(A:A,“<1”) |
1 <X <= 4 | = COUNTIF(A:A,“<= 4”)-COUNTIF(A:A,“<= 1”) |
1 <= <= 4 | = COUNTIF(A:A,“<= 4”)-COUNTIF(A:A,“<1”) |
COUNTIFS和SUMIFS多个条件的
如果您使用的是较新版本的Excel(2007 +),你是幸运的,因为有一个更简单的方法来计算和总结基于多个条件的值,使用新的COUNTIFS()和SUMIFS()函数。 他们是非常容易使用... 只要看看他们在Excel的帮助系统。
更多Excel提示
如果你喜欢的Excel技巧,请访问我的Excel提示页面,在这里您可以订阅我的Twitter的饲料,并到其他的文章中,我已经写了。 此外,检查出我的Excel模板,在行动中看到各种电子表格技术。
注意:有时你可以避开使用COUNTIF函数使用数组公式 。
Excel COUNTIF Function for Two Conditions
This short Excel tip shows how to use Excel's COUNTIF function to count the number of data points between two values. Listed below are the various conditions, and the corre
sponding formulas using the COUNTIF function. The trick is simply to subtract one condition from the other.
To download a sample spreadsheet containing these COUNTIF formulas using some made-up data, click here:countif-example.xls. This example shows how the formulas can be made a little more dynamic, by concatenating the conditional operator (<, <=, >, >=, <>) with a cell reference.
The data for the following formulas would be contained in column countif函数使用注意事项A.
Condition | Formula |
1 < x < 4 | =COUNTIF(A:A,"<4")-COUNTIF(A:A,"<=1") |
1 <= x < 4 | =COUNTIF(A:A,"<4")-COUNTIF(A:A,"<1") |
1 < x <= 4 | =COUNTIF(A:A,"<=4")-COUNTIF(A:A,"<=1") |
1 <= x <= 4 | =COUNTIF(A:A,"<=4")-COUNTIF(A:A,"<1") |
COUNTIFS and SUMIFS for Multiple Conditions
If you are using newer versions of Excel (2007+) you are in luck, because there is an even easier way to count and sum values based on multiple conditions, using the new COUNTIFS() and SUMIFS() functions. They are extremely easy to use ... just look them up in Excel's help system.
More Excel Tips
If you like Excel tips, visit my Excel Tips page, where you can subscribe to my twitter feed, and find other articles I've written. Also, check out my Excel Templates to see various spreadsheet techniques in action.
Note: Sometimes you can get around the use of the COUNTIF function by using an array formula.
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。
发表评论