'how to make an averagif formula so that the column in the reference table could be variable

I want to get average of sum rows. my problem is that my values are in some culomns and I want the forlmula to find the column based on the value I give it, automatically. in other words how to make an averagif formula so that the column in the reference table could be variable



Solution 1:[1]

Screenshot refers:

=AVERAGEIFS(INDEX(E4:J10,0,M3),D4:D10,L5)

Averageifs formula

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 JB-007