Используйте встроенную функцию ЧАСТОТА
Форма справки Excel:
Calculates how often values occur within a range of values, and then returns a vertical
array of numbers. For example, use FREQUENCY to count the number of test scores that
fall within ranges of scores. Because FREQUENCY returns an array, it must be entered
as an array formula.