简体   繁体   中英

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. It contains the name of an item, 8 different ratings, and a dollar amount. If there is not a rating for a specific column, the value is "NR" (for not rated). See attached example.

示例表

I have two metrics I need to calculate:

  1. How many items only have one rating?
  2. What is the total amount for items with only one rating?

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. Also, I would like to avoid macros.

In J2:

=SUM(--(MMULT(--(B7:I16<>"NR"),TRANSPOSE(COLUMN(B7:I16)^0))=1))

In 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.

在此处输入图片说明

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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