You can do it with this formula:
=AVERAGE(INDEX(TableSalaries,,MATCH("Employee Name1",TableSalaries[#Headers])))
where TableSalaries is the name of the table from your second attachment.
When you put it in your table, you will change constant with reference to a cell with your Employee name for which you want to display the average salary, for example:
=AVERAGE(INDEX(TableSalaries,,MATCH([@[Employee Name]],TableSalaries[#Headers])))
Explanation:
- MATCH([@[Employee Name]],TableSalaries[#Headers]) is retrieving the column number in which your employee name is present
TableSalaries[#Headers] is a list of all the strings in the header of TableSalaries table
MATCH is returning index of searched element in the list
- INDEX(TableSalaries,,MATCH([@[Employee Name]],TableSalaries[#Headers])) is returning all the values from column by number, without header of course.
INDEX(array,row_number,column_number)