I've two sheets namely Employee Data
and Salary Average Calculation
. I would like to get the average value of non blank cells from sheet 2 to sheet 1 against the respective names . I tried below formula, but got a #VALUE!
error. Please note, employee data is in a table form.
Formula:
=AVERAGEIFS('Salary Average Calculation'!B$2:B$14,'Salary Average Calculation'!B$1:G$1,\[@\[Employee Name\]\],'Salary Average Calculation'!B2:B14,"\<\>")
I tried this formula but got:
#VALUE! error
=AVERAGEIFS('Salary Average Calculation'!B$2:B$14,'Salary Average Calculation'!B$1:G$1,[@[Employee Name]],'Salary Average Calculation'!B2:B14,"<>")
I've two sheets namely Employee Data
and Salary Average Calculation
. I would like to get the average value of non blank cells from sheet 2 to sheet 1 against the respective names . I tried below formula, but got a #VALUE!
error. Please note, employee data is in a table form.
Formula:
=AVERAGEIFS('Salary Average Calculation'!B$2:B$14,'Salary Average Calculation'!B$1:G$1,\[@\[Employee Name\]\],'Salary Average Calculation'!B2:B14,"\<\>")
I tried this formula but got:
#VALUE! error
=AVERAGEIFS('Salary Average Calculation'!B$2:B$14,'Salary Average Calculation'!B$1:G$1,[@[Employee Name]],'Salary Average Calculation'!B2:B14,"<>")
Share
Improve this question
edited Mar 18 at 13:04
Mark S.
2,8191 gold badge9 silver badges28 bronze badges
asked Mar 12 at 16:09
HR- SpecializedHR- Specialized
11 silver badge2 bronze badges
5
|
1 Answer
Reset to default 0You 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)
=AVERAGE(XLOOKUP([@[Employee Name]],'Salary Average Calculation'!$B$1:$G$1,'Salary Average Calculation'!$B$2:$G$14,""))
. In older versions, try=IFNA(AVERAGE(INDEX('Salary Average Calculation'!$B$2:$G$14,,MATCH([@[Employee Name]],'Salary Average Calculation'!$B$1:$G$1,0))),"")
. I thinkAVERAGE
excludes blank cells and cells containing Nothing anyway. – VBasic2008 Commented Mar 12 at 18:00