OK, took me a while to work out the requirement, but I think I'm there!
I've added formulas to all the red cells. Some are just sums and therefore self explanatory. Others are a little more complicated.
The below is the formula from M31. The rest are build around the same principle, but with ranges amended to suit.
This formula is finding instances of 3 in your helper column then finding the minimum value against a 3. It then uses that to lookup the rest of the values using an INDEX/MATCH. For the subsequent sections if looks for the minimum value against 2 and then against 1.
It is an array formula and therefore needs to be confirmed with Ctrl+Shift+Enter.
Hope it makes some sense as well as does what you need.
Let me know.
BSB
Bookmarks