Excel AVERAGIFS Function

The Excel AVERAGEIFS function returns the average of the numbers in a specified range based on multiple criteria

Example: Excel AVERAGIFS Function

Excel AVERAGEIFS Function

METHOD 1. Excel AVERAGEIFS Function using hardcoded values

EXCEL

=AVERAGEIFS(E9:E14,B9:B14,2017,D9:D14,"Bread")
Result in cell G9 (5,485) - returns the averages of all numbers in range (E9:E14) that are associated with 2017 and Bread from ranges (B9:B14) and (D9:D14), respectively.

METHOD 2. Excel AVERAGEIFS Function using links

EXCEL

=AVERAGEIFS(E9:E14,B9:B14,C5,D9:D14,C6)
Result in cell G9 (5,485) - returns the average of all numbers in range (E9:E14) that are associated with the value in cells (C5) and (C6) from ranges (B9:B14) and (D9:D14), respectively.

METHOD 3. Excel AVERAGEIFS function using the Excel built-in function library with hardcoded values

EXCEL

Formulas tab > Function Library group > More Functions > Statistical > AVERAGEIFS > populate the input boxes

=AVERAGEIFS(E9:E14,B9:B14,2017,D9:D14,"Bread")
Note: in this example we are averaging the numbers in range (E9:E14) that are associated with 2017 and Bread from ranges (B9:B14) and (D9:D14), respectively.
Built-in Excel AVERAGEIFS Function using hardocded values

METHOD 4. Excel AVERAGEIFS function using the Excel built-in function library with links

EXCEL

Formulas tab > Function Library group > More Functions > Statistical > AVERAGEIFS > populate the input boxes

=AVERAGEIFS(E9:E14,B9:B14,C5,D9:D14,C6)
Note: in this example we are averaging the numbers in range (E9:E14) that are associated with the value in cells (C5) and (C6) from ranges (B9:B14) and (D9:D14), respectively.
Built-in Excel AVERAGEIFS Function using links

METHOD 1. Excel AVERAGEIFS function using VBA with hardcoded values

VBA

Sub Excel_AVERAGEIFS_Function()
'declare a variable
Dim ws As Worksheet
Set ws = Worksheets("AVERAGEIFS")

'apply the Excel AVERAGEIFS function
ws.Range("G9") = Application.WorksheetFunction.AverageIfs(ws.Range("E9:E14"), ws.Range("B9:B14"), 2017, ws.Range("D9:D14"), "Bread")

End Sub

OBJECTS
Worksheets: The Worksheets object represents all of the worksheets in a workbook, excluding chart sheets.
Range: The Range object is a representation of a single cell or a range of cells in a worksheet.
PREREQUISITES
Worksheet Name: Have a worksheet named AVERAGEIFS.
Average Range: Ensure that the data you want average is captured in range ("E9:E14").
Range: Ensure that the corresponding ranges (range1 and range2) to the average range are captured in ranges ("B9:B14") and ("D9:D14"), respectively.

ADJUSTABLE PARAMETERS
Output Range: Select the output range by changing the range references ("G9") in the VBA code to any cell in the worksheet, that doesn't conflict with formula.
Average Range: Select the range that you want to average by changing the range ("E9:E14") to any range in the worksheet, that doesn't conflict with the formula.
Range: Select the corresponding ranges (range1 and range2) to the average range by changing the ranges ("B9:B14") and ("D9:D14"), respectively, to any range in the worksheet, that doesn't conflict with the formula.

METHOD 2. Excel AVERAGEIFS function using VBA with links

VBA

Sub Excel_AVERAGEIFS_Function()
'declare a variable
Dim ws As Worksheet
Set ws = Worksheets("AVERAGEIFS")

'apply the Excel AVERAGEIFS function
ws.Range("G9") = Application.WorksheetFunction.AverageIfs(ws.Range("E9:E14"), ws.Range("B9:B14"), ws.Range("C5"), ws.Range("D9:D14"), ws.Range("C6"))

End Sub

OBJECTS
Worksheets: The Worksheets object represents all of the worksheets in a workbook, excluding chart sheets.
Range: The Range object is a representation of a single cell or a range of cells in a worksheet.
PREREQUISITES
Worksheet Name: Have a worksheet named AVERAGEIFS.
Average Range: Ensure that the data you want average is captured in range ("E9:E14").
Range: Ensure that the corresponding ranges (range1 and range2) to the average range are captured in ranges ("B9:B14") and ("D9:D14"), respectively.

ADJUSTABLE PARAMETERS
Output Range: Select the output range by changing the range references ("G9") in the VBA code to any cell in the worksheet, that doesn't conflict with formula.
Average Range: Select the range that you want to average by changing the range ("E9:E14") to any range in the worksheet, that doesn't conflict with the formula.
Range: Select the corresponding ranges (range1 and range2) to the average range by changing the ranges ("B9:B14") and ("D9:D14"), respectively, to any range in the worksheet, that doesn't conflict with the formula.

Usage of the Excel AVERAGEIFS function and formula syntax

EXPLANATION

DESCRIPTION
The Excel AVERAGEIFS function returns the average of all numbers in a specified range based on multiple criteria.
SYNTAX
=AVERAGEIFS(average_range, criteria_range1, criteria1, [criteria_range2], [criteria2], ...)
ARGUMENTS
average_range: (Required) The range of cells you want to average from.
criteria_range1: (Required) The range of cells that you want to test criteria1 against.
criteria1: (Required) The criteria that is used to determine which of the cells, from range1, should be averaged.
criteria_range2: (Optional) The range of cells that you want to test criteria2 against.
criteria2: (Optional) The criteria that is used to determine which of the cells, from range2, should be averaged.

ADDITIONAL NOTES
Note 1: The AVERAGEIFS function allows the use of logical elements (>,<,<>,=).
Note 2: The AVERAGEIFS function allows the use of wildcards:
* searches to find a match for the sequence of characters.
? searches to find a match to any single character.