user13770287
user13770287

Reputation:

Count how many True values appear in an array within a formula in Excel

In a formula such as this:

=if(Match(TRUE, Index(($B$5:$E$5)-$A5,,)=B$4,0),1,0)

where the return value is 1 if the difference of any of the values in range B5:E5 and cell A5 is equal to the value B4 (Relative Reference).

Is there any way to, instead of matching to the true values, count the true values?

Something Like: =countifs(Index(($B$5:$E$5)-$A5,,)=B$4,TRUE)

The former formula above will simply return 1 despite the number of true values and I also want to see the number of times the true value occurred in a separate formula.

Any help would be much appreciated.

Upvotes: 0

Views: 2301

Answers (2)

user13770287
user13770287

Reputation:

This should work:

SUMPRODUCT((INDEX(R17C3:R19C3-(R[-9]C4/1440),,)=R7C)*1)

Upvotes: 0

BigBen
BigBen

Reputation: 50007

Use SUMPRODUCT:

=SUMPRODUCT(--($B$5:$E$5-$A5=B$4))

enter image description here

Upvotes: 3

Related Questions