Excel AVERAGE Function
The Excel AVERAGE function returns the average value from a specified range
Example: Excel AVERAGE Function
=AVERAGE(C5:C8)
|
Result in cell C9 (12) - returns the average value from the selected range.
|
=AVERAGE(D5:D8)
|
Result in cell D9 (11) - returns the average value from the selected range.
|
=AVERAGE(E5:E8)
|
Result in cell E9 (12) - returns the average value from the selected range.
|
=AVERAGE(F5:F8)
|
Result in cell F9 (10,711) - returns the average value from the selected range.
|
METHOD 2. Excel AVERAGE function using the Excel built-in function library
EXCEL
Formulas tab > Function Library group > More Functions > Statistical > AVERAGE > populate the input box
=AVERAGE(C5:C8) Note: in this example we are populating the AVERAGE function with a single range. |
Sub Excel_AVERAGE_Function()
'declare a variable
Dim ws As Worksheet
Dim ws As Worksheet
Set ws = Worksheets("AVERAGE")
'apply the Excel AVERAGE function
ws.Range("C9") = Application.WorksheetFunction.Average(ws.Range("C5:C8"))
ws.Range("D9") = Application.WorksheetFunction.Average(ws.Range("D5:D8"))
ws.Range("E9") = Application.WorksheetFunction.Average(ws.Range("E5:E8"))
ws.Range("F9") = Application.WorksheetFunction.Average(ws.Range("F5:F8"))
ws.Range("C9") = Application.WorksheetFunction.Average(ws.Range("C5:C8"))
ws.Range("D9") = Application.WorksheetFunction.Average(ws.Range("D5:D8"))
ws.Range("E9") = Application.WorksheetFunction.Average(ws.Range("E5:E8"))
ws.Range("F9") = Application.WorksheetFunction.Average(ws.Range("F5:F8"))
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.
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 AVERAGE.
Worksheet Name: Have a worksheet named AVERAGE.
ADJUSTABLE PARAMETERS
Output Range: Select the output range by changing the cell references ("C9"), ("D9"), ("E9") and ("F9") in the VBA code to any cell in the worksheet, that doesn't conflict with the formula.
DESCRIPTION
The Excel AVERAGE function returns the average value from a specified range.
The Excel AVERAGE function returns the average value from a specified range.
SYNTAX
=AVERAGE(number1, [number2], ...)
=AVERAGE(number1, [number2], ...)
ARGUMENTS
number1: (Required) A single numeric cell or a range of numeric cells.
number2: (Optional) A single numeric cell or a range of numeric cells.
number1: (Required) A single numeric cell or a range of numeric cells.
number2: (Optional) A single numeric cell or a range of numeric cells.
ADDITIONAL NOTES
Note 1: In Excel 2007 and later the AVERAGE function can accept up to 255 number arguments. In Excel 2003 the AVERAGE function can only accept up to 30 number arguments.
Note 2: The AVERAGE function ignores empty cells.
Note 3: The AVERAGE function ignores TRUE and FALSE logical values.