I'm trying to count how many cells are included in specific groups of cells with specific first and last character as counting criteria.
With separate counts per group.
Here's what the end result should look like:
So that for each group of cells beginning and ending with the character "#" as first and last character, the result should sum the cells/rows from the 1st cell to the last cell of that group.
So that for each group of cells beginning and ending with the character "^" as first and last character, the result should sum the cells/rows from the 1st cell to the last cell of that group.
But the formula should exclude from count any group of cells not beginning and ending with the characters "^" or "#" as first and last character.
And ideally, display the sum result on the last cell of each group to the left (as in the B column on the above screenshot).
Up to now, I've only come up with the =ROWS() function to manually count the cells of those groups. But it is tedious.
For example, to deal with the screenshot example I would do:
=ROWS(C3:C5) (with 3 as result in cell B5)
Then
=ROWS(C8:C10) (with 3 as result in cell B10)
Nothing in cell B15
Then
=ROWS(C23:C25) (with 3 as result in cell B25)
Etc.
How to get these results with a single formula over the whole B column?