Average function across different columns

ngs007

New Member
Joined
Jul 28, 2013
Messages
21
Hi

Thought I had sorted this but now as in example below I cannot get average correct across columns (with other data in between them) because of zero values. So in example below the average should be two but it is coming out as 0.67. I have tried average if but cant seem to get it to work:

A B C D E F G H I J J
[TABLE="width: 898"]
<colgroup><col><col span="12"></colgroup><tbody>[TR]
[TD]Teacher[/TD]
[TD]Subject[/TD]
[TD]Number of observations[/TD]
[TD]Average Grade[/TD]
[TD] [/TD]
[TD]Number of observations[/TD]
[TD]Average Grade[/TD]
[TD] [/TD]
[TD]Number of observations[/TD]
[TD]Average Grade[/TD]
[TD] [/TD]
[TD]Total Number of observations[/TD]
[TD]Average Grade[/TD]
[/TR]
[TR]
[TD]pete beal[/TD]
[TD]0[/TD]
[TD]3[/TD]
[TD]2.00[/TD]
[TD] [/TD]
[TD]0[/TD]
[TD]0.00[/TD]
[TD] [/TD]
[TD]0[/TD]
[TD]0.00[/TD]
[TD] [/TD]
[TD]3[/TD]
[TD]0.67[/TD]
[/TR]
</tbody>[/TABLE]

Solution?
 
Using your posted data in A1:J2, here are 2 approaches:
This ARRAY FORMULA, completed by holding down CTRL and SHIFT when you press ENTER (instead of just pressing ENTER)
returns the average of the non-zero average grades:
Code:
J2: =AVERAGE(IF(($C$1:$H$1="Average Grade")*(C2:H2<>0),C2:H2))
or...this regular formula
Code:
J2: =SUMIF(B1:H1,"Average Grade",B2:H2)/SUMPRODUCT((B1:H1="Average Grade")*(B2:H2<>0)
)

In your example, both formulas return: 2

Is that something you can work with?
 
Upvote 0
Apologies - new to these posts. I understand that in future if I post elsewhere I have to put the url of this too. Will make sure I do so in future. Apologies again.
 
Upvote 0

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