[英]Using only an Excel formula, how do I count the number of rows that meet multiple criteria (including a countif)?
I have a spreadsheet with 10 columns.我有一个包含 10 列的电子表格。 It contains the name of an item, 8 different ratings, and a dollar amount.
它包含一个项目的名称、8 个不同的评级和一个美元金额。 If there is not a rating for a specific column, the value is "NR" (for not rated).
如果特定列没有评级,则值为“NR”(未评级)。 See attached example.
见附件示例。
I have two metrics I need to calculate:我有两个指标需要计算:
The list can be refreshed, so the number of items can vary.该列表可以刷新,因此项目数量可能会有所不同。 Also, I want to avoid using adjacent formulas because of the variable length and high probability of additional columns being added.
此外,我想避免使用相邻的公式,因为长度可变且添加额外列的可能性很高。
I have played with SUMPRODUCT, nested COUNTIF(S), and various array formulas, but I cannot seem to get the solution.我玩过 SUMPRODUCT、嵌套的 COUNTIF(S) 和各种数组公式,但我似乎无法得到解决方案。 Also, I would like to avoid macros.
另外,我想避免使用宏。
In J2:在 J2 中:
=SUM(--(MMULT(--(B7:I16<>"NR"),TRANSPOSE(COLUMN(B7:I16)^0))=1))
In J4:在 J4 中:
=SUM((MMULT(--(B7:I16<>"NR"),TRANSPOSE(COLUMN(B7:I16)^0))=1)*J7:J16)
Depending on one's version one may need to confirm this array formula with Ctrl-Shift-Enter instead of Enter when exiting edit mode.根据版本的不同,退出编辑模式时可能需要使用 Ctrl-Shift-Enter 而不是 Enter 确认此数组公式。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.