Average entire row

To average all values in a single row you can apply an Excel or a VBA method using the Excel AVERAGE function

Example: Average entire row

Average entire row

METHOD 1. Average entire row

EXCEL

=AVERAGE(5:5)
The formula uses the Excel AVERAGE function to average all of the numbers in row 5.

METHOD 1. Average entire row using VBA

VBA

Sub Average_entire_row()
'declare a variable
Dim ws As Worksheet
Set ws = Worksheets("Analysis")
'apply the formula to average all numbers in row 5
ws.Range("C7") = Application.WorksheetFunction.Average(ws.Range("5:5"))

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 Analysis.
Data Range: Ensure that the data that you want to average from is captured in range ("5:5") in the Analysis worksheet.

ADJUSTABLE PARAMETERS
Date Range: Select the row that you want to average by changing range ("5:5") to any range in the worksheet, that doesn't conflict with the formula.
Output Range: Select the output range by changing the cell reference ("C7") to any cell in the worksheet, that doesn't conflict with the formula.

Explanation about the formula used to average entire row

EXPLANATION

EXPLANATION
To average all values in a single row you can apply an Excel or a VBA method. The formula used to average values in an entire row is driven by an Excel AVERAGE function.
In both the VBA and Excel examples the formula averages all of the numbers in row 5. This is achieved through the use of the Excel AVERAGE function.
FORMULA
=AVERAGE(row_reference)
ARGUMENTS
row_reference: The row which you want to average.