The average is calculated by summing the specified numbers and dividing them by the total values selected. We use averages because it’s beneficial to contrast different quantities of the same category. In Microsoft Excel, we can calculate the average of multiple ranges. In this article, we will demonstrate how to calculate the average of multiple ranges in Excel.
How to Calculate Average of Multiple Ranges in Excel: 3 Methods
It is quite unknown to many of the users that we can compute the average of multiple ranges in Excel. But yes we can do that with some Excel functions in our spreadsheet. To calculate the average of multiple ranges, we are going to use the dataset below. The dataset contains a player column and scores of all those players in a particular game.
As we can see there are 3 players in our dataset. Suppose we want to calculate the average of the first player (P1) and second player (P2) scores from Game1 Score and the first player (P1) score from Game2 Score and also the first player (P1) and second player (P2) scores from Game3 Score. So, we want the multiple ranges of cells average.
1. Use the Excel AVERAGE Function to Calculate the Average of Multiple Non-Adjacent Ranges Counting Zero
In Excel, the AVERAGE function computes the average of a set of values, a set of ranges. Sometimes, the numbers are non-adjacent and we have to calculate the values rapidly. Let’s start with a basic understanding of the AVERAGE function in Excel.
âž§ Syntax:
The syntax for the AVERAGE function is:
AVERAGE(number1, [number2], …)
âž§ Arguments:
number1: [required] The first integer, cell reference, or range for which the average should be calculated.
number2: [optional] Up to 255 more numbers, cell references, or ranges for which the average should be calculated.
âž§ Return Value:
The arithmetic means of the parameters.
1.1. Add the Ranges to the AVERAGE Function One by One
Let’s add the multiple ranges to the AVERAGE function one by one to calculate the average of the selected ranges by just following the steps down.
STEPS:
- First, select the cell where we want the average of the multiple ranges. So, we select cell D12.
- Then, type the formula below. We want the average of ranges C5:C9, D5:D7, and E5:E9, inside the AVERAGE function. Select all the ranges that we wish to average, by pressing Ctrl and dragging over the ranges.
=AVERAGE(C5:C9,D5:D7,E5:E9)
- Now, press Enter.
- Now, we can see that the result is in the selected cell D12. The formula will be shown in the formula bar.
The above result is for non-contiguous ranges, including zero.
Read More: How to Calculate Average of Multiple Columns in Excel
1.2. Give Range Name to Multiple Ranges
We can shorten the formula of the AVERAGE function in the same dataset.
STEPS:
- First, select the ranges C5:C9, D5:D7, and E5:E9 by dragging over the ranges. While dragging and selecting the ranges make sure that you are pressing the Ctrl key.
- After that, give a name to the selected ranges. As we select the scores, we name the multiple ranges, Score.
- Next, choose the cell where we want the average of the multiple ranges to be calculated. We selected cell D12.
- After that, write down the formula below.
=AVERAGE(Score)
- Now, press the Enter key.
- Finally, the result will be shown in cell D12. And if we look at the formula bar, the formula will appear.
The above result is the average of multiple non-contiguous ranges including zero.
2. Apply Excel Formula to Determine Average of Multiple Non-Adjacent Ranges Except Zero
To average values in non-contiguous ranges except zero, we can use a formula that is a combination of some Excel functions. There are SUM, INDEX, and FREQUENCYÂ functions merged together to calculate the average of multiple ranges.
2.1. Average Ranges One by One in Excel Formula
We can add multiple ranges towards the combination of the SUM, INDEX, and FREQUENCY functions at once to find the average, by simply following the instructions.
STEPS:
- In the beginning, select cell D12.
- Then, write down the formula below.
=SUM(C5:C9,D5:D7,E5:E9)/INDEX(FREQUENCY((C5:C9,D5:D7,E5:E9),0),2)
- After that, press the Enter button.
- Finally, we can see the result in cell D12. Multiple non-contiguous ranges excluding zero, are averaged using the formulas above.
🔎 How Does the Formula Work?
- SUM(C5:C9,D5:D7,E5:E9): The SUM function will simply add up the ranges C5:C9, D5:D7, and E5:E9 and return the total of the selected multiple ranges.
Output → 788
- FREQUENCY((C5:C9,D5:D7,E5:E9),0): The FREQUENCY function returns a vertical array of integers after calculating how often values occur within a range of values. FREQUENCY(C5:C9,D5:D7,E5:E9) becomes FREQUENCY($C$5:$C$9,$D$5:$D$7,$E$5:$E$9), which locks the reference to a certain cell. Then, FREQUENCY(($C$5:$C$9,$D$5:$D$7,$E$5:$E$9),0) returns a vertical array.
Output → 1
- INDEX(FREQUENCY((C5:C9,D5:D7,E5:E9),0),2): The INDEX function returns the value at a certain point in a range or array. It becomes INDEX({1;12},2). That means it returns the result at that location in a range. By omitting zero we have 12 cells.
Output → 12
- SUM(C5:C9,D5:D7,E5:E9)/INDEX(FREQUENCY((C5:C9,D5:D7,E5:E9),0),2): This returns the average of multiple ranges. It becomes 788/{12} and returns the average of ranges.
Output → 65.67
Read More: How to Calculate Average in Excel Excluding 0
2.2. Give the Multiple Range a Name
The combination of the Excel functions can be shortened. So, let’s go through the steps down.
STEPS:
- Likewise, in the previous method of section 1.2, drag ranges C5:C9, D5:D7, and E5:E9. Be careful to keep the Ctrl key pressed while dragging and choosing the ranges.
- After that, give the selected ranges a name. We named the ranges as Scores.
- Then, select the cell where the average of the several ranges will be calculated. As a result, we select D12.
- After selecting the cell, type the following formula.
=SUM(Scores)/INDEX(FREQUENCY((Scores),0),2)
- Finally, press Enter.
Read More: How to Calculate Average Only for Cells with Values in Excel
3. Excel VBA to Calculate Average of Multiple Ranges
We can use VBA Macros to calculate the average of multiple ranges. To do this, we are going to use the dataset below, which contains some players and their scores of the games. We want the average of the scores of those games they played under the Average Score.
STEPS:
- Firstly, go to the Developer tab on the ribbon.
- Then, click on Visual Basic or press Alt + F11 to open the Visual Basic Editor.
- Another way to open the Visual Basic Editor is to simply right-click on the sheet and select View Code.
- Now, write down the VBA code to calculate the average of multiple ranges. This code is based on the built-in VBA Average function. With this, we can average as many ranges of cells as we want.
VBA Code:
Sub Average_Multiple_Ranges()
Dim s As Worksheet
Set s = Worksheets("VBA")
s.Range("F5") = Application.WorksheetFunction.Average(s.Range("C:D"))
End Sub
- Finally, run the code by pressing F5 or clicking the Run Sub button.
- And by using this VBA code we will get the average of multiple ranges in Excel.
Download Practice Workbook
You can download the workbook and practice with them.
Conclusion
The above methods assist you in calculating the average of multiple ranges in Excel. Hope this will help you! If you have any questions, suggestions, or feedback please let us know in the comment section.
Related Articles
- How to Find Average of Specific Cells in Excel
- How to Average Only Visible Cells in Excel
- How to Find Average with Blank Cells in Excel
- How to Average a Column in Excel
- How to Average Every Nth Row in Excel
- How to Exclude a Cell in Excel AVERAGE Formula
- How to Fix Divide by Zero Error for Average Calculation in Excel
- How to Ignore #N/A Error When Getting Average in Excel
- [Fixed!] AVERAGE Formula Not Working in Excel