Take average of each category and then compute the average

alektherussian

New Member
Joined
Sep 12, 2014
Messages
8
Hi there,

I have a problem that I can demonstrate in simplified way as follows:
Company
Amount
A
500
B
200
C
400
A200
B
400

<tbody>
</tbody>
I would like a formula that would first calculate the average over each category (i.e., A = 350, B = 300, and C = 400) and then take the average of the three amounts (i.e., 350). The key is I would like this to be done with a formula(I believe it would have to be some complex array formula) without creating supplemental columns or a PivotTable.

Is this at all possible? Or is writing a custom VBA formula the only option?

Thank you all for you help!

-Alex
 

Excel Facts

Using Function Arguments with nested formulas
If writing INDEX in Func. Arguments, type MATCH(. Use the mouse to click inside MATCH in the formula bar. Dialog switches to MATCH.
Welcome to the Board!

Maybe something like this:


Excel 2012
ABCDEF
1CompanyAmountCompanyAverageAverage All
2A500A350350
3B200B300
4C400C400
5A200
6B400
Sheet1
Cell Formulas
RangeFormula
E2=AVERAGEIF(Sheet1!$A$2:$A$6,D2,Sheet1!$B$2:$B$6)
E3=AVERAGEIF(Sheet1!$A$2:$A$6,D3,Sheet1!$B$2:$B$6)
E4=AVERAGEIF(Sheet1!$A$2:$A$6,D4,Sheet1!$B$2:$B$6)
F2=AVERAGE(E2:E4)


HTH,
 
Upvote 0
maybe this



Excel 2007
ABCD
1CompanyAmount
2A500350
3B200
4C400
5A200
6B400
Sheet3
Cell Formulas
RangeFormula
D2=(AVERAGEIF(A2:A6,"A",B2:B6)+AVERAGEIF(A2:A6,"B",B2:B6)+AVERAGEIF(A2:A6,"C",B2:B6))/3
 
Upvote 0
Thank you Michael M and Smitty. Both of your approaches definitely work for this situation.

It seems that I wasn't quite clear in my question. The provided example is a simplified version of the real problem. In the actual problem i will have multiple sets with more than 100 company names. This means in Smitty's solution I would have to create a range with all the unique company names or in Michael's solution, i'd have an extremely long formula and I'd need to point out to each unique company in the AVERAGEIF formula.

Thank you again for your help!
 
Upvote 0
Thank you! When I was trying to figure this out I also thought that it'd probably be easier if I had some more mathematical knowledge and figure how to do such calculations at least conceptually.
 
Upvote 0
I have mathematical training and taking the average of averages raised huge alarm bells with me.
In the OP example, the 350 final figure that you get is different than the average of the numbers (340).

Huge, Huge Huge alarm bells!!
Drawing any conclusions from the number you seek is not a good idea.

That being said, with the layout in post #2 the formula =AVERAGE(AVERAGEIF(A1:A5,D1:D3,B1:B5)) will give you this useless number.

Or you could use =AVERAGE(AVERAGEIF(A1:A5, A1:A5, B1:B5)) entered with Ctrl-Shift-Enter
 
Last edited:
Upvote 0
Thank you Mikerickson - really appreciate your response! I understand the dangers of this approach and agree with you (and so do my colleagues), but some companies have a "standard methodology" do calculate certain things that don't always make sense...

Is it at all possible to perform such calculation without creating column, like column D in post #2? It would require to create a list of unique values for every new set of companies in column A.

Thank you again!
 
Upvote 0
The second formula that I posted doesn't require a separate list of the unique entries in column A. I haven't tested to see if it will work with full column references, but dynamic ranges should accommodate a changing list of names and values.
 
Upvote 0

Forum statistics

Threads
1,216,107
Messages
6,128,866
Members
449,475
Latest member
Parik11

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