Modifica

Condividi tramite


WorksheetFunction.AverageIfs Method

Definition

Returns the average (arithmetic mean) of all cells that meet multiple criteria.

public double AverageIfs (Microsoft.Office.Interop.Excel.Range Arg1, Microsoft.Office.Interop.Excel.Range Arg2, object Arg3, object Arg4, object Arg5, object Arg6, object Arg7, object Arg8, object Arg9, object Arg10, object Arg11, object Arg12, object Arg13, object Arg14, object Arg15, object Arg16, object Arg17, object Arg18, object Arg19, object Arg20, object Arg21, object Arg22, object Arg23, object Arg24, object Arg25, object Arg26, object Arg27, object Arg28, object Arg29);
Public Function AverageIfs (Arg1 As Range, Arg2 As Range, Arg3 As Object, Optional Arg4 As Object, Optional Arg5 As Object, Optional Arg6 As Object, Optional Arg7 As Object, Optional Arg8 As Object, Optional Arg9 As Object, Optional Arg10 As Object, Optional Arg11 As Object, Optional Arg12 As Object, Optional Arg13 As Object, Optional Arg14 As Object, Optional Arg15 As Object, Optional Arg16 As Object, Optional Arg17 As Object, Optional Arg18 As Object, Optional Arg19 As Object, Optional Arg20 As Object, Optional Arg21 As Object, Optional Arg22 As Object, Optional Arg23 As Object, Optional Arg24 As Object, Optional Arg25 As Object, Optional Arg26 As Object, Optional Arg27 As Object, Optional Arg28 As Object, Optional Arg29 As Object) As Double

Parameters

Arg1
Range

One or more ranges in which to evaluate the associated criteria.

Arg2
Range
Arg3
Object
Arg4
Object
Arg5
Object
Arg6
Object
Arg7
Object
Arg8
Object
Arg9
Object
Arg10
Object
Arg11
Object
Arg12
Object
Arg13
Object
Arg14
Object
Arg15
Object
Arg16
Object
Arg17
Object
Arg18
Object
Arg19
Object
Arg20
Object
Arg21
Object
Arg22
Object
Arg23
Object
Arg24
Object
Arg25
Object
Arg26
Object
Arg27
Object
Arg28
Object
Arg29
Object

Returns

Remarks

If a cell in average_range is an empty cell, AverageIfs ignores it.

If a cell in a criteria range is empty, AverageIfs treats it as a 0 value.

Cells in range that contain true evaluate as 1; cells in range that contain false evaluate as 0 (zero).

Each cell in average_range is used in the average calculation only if all of the corresponding criteria specified are true for that cell.

If cells in average_range are empty or contain text values that cannot be translated into numbers, AverageIfs generates an error.

If there are no cells that meet all the criteria, AverageIfs generates an error value.

You can use the wildcard characters, question mark (?) and asterisk (*), in criteria. A question mark matches any single character; an asterisk matches any sequence of characters. If you want to find an actual question mark or asterisk, type a tilde (~) before the character.

Each criteria_range does not have to be the same size and shape as average_range. The actual cells that are averaged are determined by using the top, left cell in that criteria_range as the beginning cell, and then including cells that correspond in size and shape to range. For example:

A1:A5B1:B5B1:B5
A1:A5B1:B3B1:B5
A1:B4C1:D4C1:D4
A1:B4C1:C2C1:D4

The AverageIfs function measures central tendency, which is the location of the center of a group of numbers in a statistical distribution. The three most common measures of central tendency are:

  • Average which is the arithmetic mean, and is calculated by adding a group of numbers and then dividing by the count of those numbers. For example, the average of 2, 3, 3, 5, 7, and 10 is 30 divided by 6, which is 5.
  • Median which is the middle number of a group of numbers; that is, half the numbers have values that are greater than the median, and half the numbers have values that are less than the median. For example, the median of 2, 3, 3, 5, 7, and 10 is 4.
  • Mode which is the most frequently occurring number in a group of numbers. For example, the mode of 2, 3, 3, 5, 7, and 10 is 3.

For a symmetrical distribution of a group of numbers, these three measures of central tendency are all the same. For a skewed distribution of a group of numbers, they can be different.

Applies to