How to count similar groups of items in a list using Excel?

Viewed 51

I thought I was getting pretty good with Excel sumifs/maxifs/minifs/countifs but I am stuck on this one. I am trying to count the number of grouped elements in a list, using a concise formula in a single column (manually copied down the array range) preferably using one of my favorites mentioned above and without using Excel's annoying array function where you have to press Ctrl/Shift/Enter, and without using VBA. I illustrate and explain the desired outputs of block group counts below in yellow. Any ideas for a formula that does this?

The << Formula columns are only illustrating countifs() using a single condition and multiple conditions, respectively.

enter image description here

2 Answers

Try below formula-

=BYROW(B3:B17,LAMBDA(x,SUM(--((UNIQUE(FILTER(C3:C17,(B3:B17=x)*(ROW(C3:C17)<=ROW(x)))))<>""))))

enter image description here

Related