0

I want to be able to provide a count of distinct values of one column ("ID", in column B below) where a value in the respective row (eg "Value" in Column C below) meets a criteria (eg <>0) below. As you can see, I can easily compute the list of unique ID's (cell B8, with formula in C8) but can't fathom how to pair this with the discovery of non-zero values.

enter image description here

Topdown
  • 443
  • 1
  • 8
  • 17

3 Answers3

1

I've formulated an answer to sort of a similar question here. Particulary handy if you want to extend with multiple criteria.

In your case it would look a bit more symplistic cause you have numeric values (ID's)

{=SUM(--(FREQUENCY(IF(Table1[Value]>0,Table1[ID])Table1[ID])>0))}

Entered through CtrlShiftEnter

enter image description here

JvdV
  • 70,606
  • 8
  • 39
  • 70
0

You can use the double unary operator (--) to revert a true/false to 0 or 1 then use that in the sumproduct like so:

=SUMPRODUCT((1/COUNTIF($B$3:$B$6,$B$3:$B$6))*(--($C$3:$C$6<>0)))

Glitch_Doctor
  • 2,994
  • 3
  • 16
  • 30
0

Here's another (non array) option

=SUM(($C$3:$C$6<>0)/COUNTIFS($B$3:$B$6,$B$3:$B$6))

Or, if the data is a Table as your image suggests

=SUM((YourTableName[Value]<>0)/COUNTIFS(YourTableName[ID],YourTableName[ID]))
chris neilsen
  • 52,446
  • 10
  • 84
  • 123