Best way to calculate multiple averages? (See sample mini-sheet)

wrecclesham

Board Regular
Joined
Jul 24, 2019
Messages
52
Office Version
  1. 365
Platform
  1. Windows
Book1
BCD
2Average
3Apples65
4Apples62
5Apples1647.7
6Oranges17
7Oranges6139.0
8Peaches17
9Peaches72
10Peaches24
11Peaches6243.8
12Tomatoes9696.0
Sheet1
Cell Formulas
RangeFormula
D5D5=AVERAGE(C3:C5)
D7D7=AVERAGE(C6:C7)
D11D11=AVERAGE(C8:C11)
D12D12=AVERAGE(C12)

I have a similar spreadsheet to the one above, containing several thousand rows of data.

How could I calculate the green column automatically?
 
The data in the spreadsheet looks better.
1. concept works with multiple columns such as subjects
2. you can copy the visible data and sort on that range
Select the cells that you want to copy
Click Home > Find & Select, and pick Go To Special
.Click Visible cells only > OK.
Click Copy or press Ctrl+C.
Paste at relevant location
Sort

T202211b.xlsm
ABCD
1
2NameMathEnglish
6Name 1 Avg47.779.0
9Name 2 Avg39.062.5
14Name 3 Avg43.877.5
16Name 4 Avg96.090.0
17Grand Avg49.276.2
18
19
20Sorted descending on Math
21NameMathEnglish
22Name 4 Avg96.090.0
23Name 1 Avg47.779.0
24Name 3 Avg43.877.5
25Name 2 Avg39.062.5
26
7bb
Cell Formulas
RangeFormula
C6:D6C6=SUBTOTAL(1,C3:C5)
C9:D9C9=SUBTOTAL(1,C7:C8)
C14:D14C14=SUBTOTAL(1,C10:C13)
C16:D16C16=SUBTOTAL(1,C15:C15)
C17:D17C17=SUBTOTAL(1,C3:C15)
 
Last edited:
Upvote 0

Excel Facts

Waterfall charts in Excel?
Office 365 customers have access to Waterfall charts since late 2016. They were added to Excel 2019.
You could also calculate the averages and prepare the report (sorted from highest to lowest) with one formula using Excel 365.

We do not know the location of the names and amounts with your data and we do not know if you want the report on the same sheet or another.

You could post 20 -30 rows that illustrate your data; the forum provides a tool named XL2BB to help with this process.
 
Upvote 0
I prepared an example of the formula that I mentioned in post # 22.
Notes
1. the data is not sorted
2. the report can be on the same sheet or on another sheet
3. the report can show just the top 5 or number that you specify ( I include an example but ignore this if it isn't applicable.
4. the named ranges are not necessary; they make the formula easier to read and I do not know the layout of a user's data
5. the formula is entered in one cell and the information spills right and down

An extract of the data follows and the result of the formula(s) is in the next post.
Averageifs.xlsm
ABCDE
1Name ClassSubjectGrades
2A90%
3A89%
4A88%
5A91%
6A-294%
7A-297%
8B92%
9B92%
10Z80%
11Z75%
12Z75%
13C92%
14C92%
15C92%
16Z88%
17D99%
18D99%
19E65%
20E55%
21E55%
22E65%
23E55%
24E65%
25E65%
26E65%
27E65%
28F75%
29F77%
30F79%
31F81%
32F83%
33F85%
34F87%
35F89%
36F91%
37F93%
38G99%
39G99%
40H72%
41H72%
42I82%
43I85%
44I88%
45I91%
46I94%
47I97%
48A-272%
49A-274%
50B-276%
51B-278%
52I100%
53A-280%
54A-282%
55B-284%
56B-286%
Data
 
Upvote 0
Averageifs.xlsm
ABCDEF
1NameAverage GradeTop 5 NameAverage Grade
2D99.0%D99.0%
3G99.0%G99.0%
4B92.0%B92.0%
5C92.0%C92.0%
6I91.0%I91.0%
7A89.5%
8F84.0%
9A-283.2%
10B-281.0%
11Z79.5%
12H72.0%
13E61.7%
Report
Cell Formulas
RangeFormula
B2:C13B2=LET(u,UNIQUE(FILTER(rN,rN>"")),SORT(HSTACK(u,AVERAGEIFS(rG,rN,u)),2,-1))
E2:F6E2=LET(u,UNIQUE(FILTER(rN,rN<>"")),TAKE(SORT(HSTACK(u,AVERAGEIFS(rG,rN,u)),2,-1),5))
Dynamic array formulas.
Named Ranges
NameRefers ToCells
rG=Data!$E$2:$E$56B2, E2
rN=Data!$B$2:$B$56B2, E2
 
Upvote 0

Forum statistics

Threads
1,214,518
Messages
6,119,988
Members
448,935
Latest member
ijat

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top