Excel AVERAGEIFS function: the average with multiple conditions
AVERAGEIFS averages values that meet several conditions: department, city, years of service. Argument order, #DIV/0! and an average without outliers.
AVERAGEIFS calculates the average over rows where every condition is met. “What is the average salary in the sales department in Tashkent?”, “What is the average salary of staff with more than 3 years of service?”, “What was the average receipt at the Samarkand branch in February?”.
In HR, sales and finance analysis this is one of the most common questions: “how much on average — but only for this group”. AVERAGEIFS answers all of them with one formula.
| A | B | C | D | E | F | G | |
|---|---|---|---|---|---|---|---|
| 1 | Department | City | Years | Salary | Question | Answer | |
| 2 | Sales | Tashkent | 2 | 6 500 000 | Sales, Tashkent | 6 866 667 | |
| 3 | IT | Tashkent | 5 | 14 000 000 | |||
| 4 | Sales | Samarkand | 4 | 5 800 000 | |||
| 5 | Sales | Tashkent | 6 | 8 900 000 | |||
| 6 | IT | Samarkand | 1 | 7 500 000 | |||
| 7 | Finance | Tashkent | 3 | 9 200 000 | |||
| 8 | Sales | Tashkent | 1 | 5 200 000 | |||
| 9 |
Syntax
=СРЗНАЧЕСЛИМН(average_range; criteria_range1; criteria1; [criteria_range2; criteria2]; ...)
- average_range — the numbers to average:
D2:D8. It comes first. - criteria_range1, criteria1 — the first condition:
A2:A8,"Sales". - criteria_range2, criteria2 … — more conditions, up to 127 pairs.
The rules match SUMIFS: conditions are joined with “and”, all ranges are the same size. Blank cells and text in average_range are ignored. If no row matches — #DIV/0!.
Step by step: entering AVERAGEIFS
1
Select F2 for the result.
2
Формулы → Вставить функцию → type AVERAGEIFS in the search box (category Statistical) and click OK.
| A | B | C | D | E | F | G | |
|---|---|---|---|---|---|---|---|
| 1 | Department | City | Years | Salary | Question | Answer | |
| 2 | Sales | Tashkent | 2 | 6 500 000 | Sales, Tashkent | ||
| 3 | IT | Tashkent | 5 | 14 000 000 | |||
| 4 | |||||||
| 5 |
3
First Average_range — D2:D8 (salaries). Then the pairs: A2:A8 and "Sales", B2:B8 and "Tashkent". Click OK.
| A | B | C | D | E | F | G | |
|---|---|---|---|---|---|---|---|
| 1 | Department | City | Years | Salary | Question | Answer | |
| 2 | Sales | Tashkent | 2 | 6 500 000 | Sales, Tashkent | ||
| 3 | IT | Tashkent | 5 | 14 000 000 | |||
| 4 | |||||||
| 5 |
4
The result is 6,866,667. The formula: =СРЗНАЧЕСЛИМН(D2:D8;A2:A8;"Sales";B2:B8;"Tashkent").
Example 1: a numeric condition and conditions in cells
A condition on years of service is a plain comparison: =СРЗНАЧЕСЛИМН(D2:D8;A2:A8;"Sales";C2:C8;">=3").
Move the conditions into cells and one formula becomes a “mini calculator”: change the department, city and minimum years and get the answer instantly. With a numeric threshold in a cell, use ">="&F3:
=СРЗНАЧЕСЛИМН(D2:D8;A2:A8;F1;B2:B8;F2;C2:C8;">="&F3)
| A | B | C | D | E | F | G | |
|---|---|---|---|---|---|---|---|
| 1 | Department | City | Years | Salary | Department | Sales | |
| 2 | Sales | Tashkent | 2 | 6 500 000 | City | Tashkent | |
| 3 | IT | Tashkent | 5 | 14 000 000 | Min. years | 21 | |
| 4 | Sales | Samarkand | 4 | 5 800 000 | Average salary | 7 700 000 | |
| 5 | Sales | Tashkent | 6 | 8 900 000 | Sales, 3+ years | 7 350 000 | |
| 6 | IT | Samarkand | 1 | 7 500 000 | |||
| 7 | Finance | Tashkent | 3 | 9 200 000 | |||
| 8 | Sales | Tashkent | 1 | 5 200 000 | |||
| 9 |
| A | B | C | D | E | F | G | |
|---|---|---|---|---|---|---|---|
| 1 | Department | City | Years | Salary | Formula | Result | |
| 2 | Sales | Tashkent | 2 | 6 500 000 | AVERAGEIF | 10 750 0001 | |
| 3 | IT | Tashkent | 5 | 14 000 000 | AVERAGEIFS | 10 750 0002 | |
| 4 | Sales | Samarkand | 4 | 5 800 000 | IT, Bukhara | No data | |
| 5 | Sales | Tashkent | 6 | 8 900 000 | |||
| 6 | IT | Samarkand | 1 | 7 500 000 | |||
| 7 | Finance | Tashkent | 3 | 9 200 000 | |||
| 8 | Sales | Tashkent | 1 | 5 200 000 | |||
| 9 |
Pro level: an average without outliers, and the median
With salaries, prices or real estate, one very large value drags the average along. Two professional techniques:
- An average without the extremes. Use the average range itself as a condition:
=СРЗНАЧЕСЛИМН(D2:D8;D2:D8;">"&МИН(D2:D8);D2:D8;"<"&МАКС(D2:D8))— the average without the minimum and maximum. - A conditional median. There is no “MEDIANIFS”, but in Microsoft 365
=МЕДИАНА(ФИЛЬТР(D2:D8;A2:A8="Sales"))does exactly that.
Show the average and the median side by side in a report, and nobody will draw the wrong conclusion about the “average salary”.
| A | B | C | D | E | F | G | |
|---|---|---|---|---|---|---|---|
| 1 | Department | City | Years | Salary | Measure | Value | |
| 2 | Sales | Tashkent | 2 | 6 500 000 | AVERAGE | 8 157 143 | |
| 3 | IT | Tashkent | 5 | 14 000 000 | No extremes | 7 580 000 | |
| 4 | Sales | Samarkand | 4 | 5 800 000 | MEDIAN | 7 500 000 | |
| 5 | Sales | Tashkent | 6 | 8 900 000 | Sales median | 6 150 000 | |
| 6 | IT | Samarkand | 1 | 7 500 000 | |||
| 7 | Finance | Tashkent | 3 | 9 200 000 | |||
| 8 | Sales | Tashkent | 1 | 5 200 000 | |||
| 9 |
Try it in the simulator
Type =СРЗНАЧЕСЛИМН(D2:D8;A2:A8;"Sales";B2:B8;"Tashkent") in F2. Then in F3 calculate the average salary of salespeople with 3+ years: =СРЗНАЧЕСЛИМН(D2:D8;A2:A8;"Sales";C2:C8;">=3").
| A | B | C | D | E | F | G | H | I | J | K | L | M | N | O | P | Q | R | S | T | U | V | W | X | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 1 | Department | City | Years | Salary | Question | Answer | ||||||||||||||||||
| 2 | Sales | Tashkent | 2 | 6500000 | Sales, Tashkent | |||||||||||||||||||
| 3 | IT | Tashkent | 5 | 14000000 | Sales, 3+ years | |||||||||||||||||||
| 4 | Sales | Samarkand | 4 | 5800000 | ||||||||||||||||||||
| 5 | Sales | Tashkent | 6 | 8900000 | ||||||||||||||||||||
| 6 | IT | Samarkand | 1 | 7500000 | ||||||||||||||||||||
| 7 | Finance | Tashkent | 3 | 9200000 | ||||||||||||||||||||
| 8 | Sales | Tashkent | 1 | 5200000 | ||||||||||||||||||||
| 9 | ||||||||||||||||||||||||
| 10 | ||||||||||||||||||||||||
| 11 | ||||||||||||||||||||||||
| 12 |
Has ExcelLab been useful?
Support the project and help us release new lessons and exercises.