=ArrayFormula(average(LARGE(($B$2:$B$2477=$B2)*(G$2:G$2477),ROW(INDIRECT("1:"&$D2)))))
Formula calculates the average value for the industry, but only inclu