Yaniv Aflalo
Yaniv Aflalo

Reputation: 249

Count range by condition that involves 2 other ranges

Background

Goal

In sheet A, range B5:B24 - I want to have a total count of students for each class in range A5:A24.

Meaning: for each row of range H5:O in sheet B - count string values in columns K to O if cell column H is found in range A5:A24 in sheet A. Then, sum it up per each row in this last range.

This can theoretically be between 0 to infinity (depending on the occurrences of a class and the number of attending students.

Example Spreadsheet

https://docs.google.com/spreadsheets/d/1T7_zPxbGmyLSSWQ3ur443EY9zjbNhy4EAJyZtXsfr4o/edit?usp=sharing

Upvotes: 0

Views: 51

Answers (1)

Benoît Wéry
Benoît Wéry

Reputation: 862

I think putting this formula in 'Sheet A'!B5:B24 will do the trick:

=counta(iferror(filter('Sheet B'!$K$5:$O,'Sheet B'!$H$5:$H=A5),))

Upvotes: 1

Related Questions