With the data sorted you can dispense with the need for the AVERAGE if altogether - if you're prepared to use additional helper calcs.
It's often the case that a greater number of lightweight calcs will perform far better than fewer more elegant yet expensive formulae.
Illustrating via your latest sample
what this does is essentially conduct the average on the sheet itself but only looking at a small subset of the data (once per Joint@OutputCase combination) and using binary search to identify the ranges... this means these calculations are incredibly fast.
With the above in place all you need do now is modify the formula on your summary sheet to utilise these values and again use Binary Search based Lookup to retrieve the appropriate value.
The above performs two binary search based lookups - the first retrieves the last average value listed where the key code is <= $A4&"@"&$F$2.
It follows that given LOOKUP is approximate match test the resulting value may or may not be for this specific key so we multiply the result by whether or not the key matches our criteria (0 result if not).
It's very important to note that this type of LOOKUP is blindingly fast so even though we're conducting two LOOKUPs they will be significantly quicker than the single AVERAGEIF calc being performed previously.
With the above approach implemented in your file the calculation time for the matrix dropped from 0.6 seconds to between 0.02 and 0.04 seconds ... ie very very fast and a big % gain.
The key is all calculations in place are now very light weight and as such will perform very efficiently - even though there are more of them.
Bookmarks