Average if a column contains x or y

Fazila

Board Regular
Joined
Nov 19, 2014
Messages
163
I'm hoping this is an easy fix. I need a formula that will average data in a column if a column contains x or y.

Currently I have:

N22 ={IFERROR(AVERAGE(IF((SEN={"n",""}),KS2A)),"")}

However, this is returning 4.49 when it should be 4.83. It might be converting blanks to 0 hence the discrepancy.

I also need to find the gap between this figure and two other categories. The formula I am using for this is:

={IFERROR(AVERAGE(IF(ISNUMBER(MATCH(SEN,{"K","E"},0)),KS2A))-n22,"")}

Again, this is returning a lower figure - could it be converting blanks to 0 again?

Any ideas?

Thanks

Fazila
 

Excel Facts

Easy bullets in Excel
If you have a numeric keypad, press Alt+7 on numeric keypad to type a bullet in Excel.
Hi,

Could you describe the actual set-up of your worksheet ...

Do you have numbers or formulas producing your numbers ?
 
Upvote 0
The worksheet is quite large one sheet has the raw data in which there are these column amongst many others:

SENKS2A
K4.7
K4
N4.2
4.3
E4.1
5.3

<tbody>
</tbody>

The formula goes into another sheet called Group analysis.

On this sheet I have the following table:

GroupKS2 APS (average)
K=IFERROR(AVERAGEIF(SEN,$B19,KS2A),"")
E=IFERROR(AVERAGEIF(SEN,$B21,KS2A),"")
No SEN=IFERROR(SUM(COUNTIFS(SEN,{"n",""},Basics5,"Y"))/$D22,"")
GapNo SEN - K and E

<tbody>
</tbody>

I hope this makes things a little more clearer?

Thanks for helping James006
 
Upvote 0
Hi again,

From your description ... regarding your two first formulas ...

assuming SEN and KS2A are your two named Ranges ( with identical size ) ...

As long as cell $B19 contains K and cell $B21 contains E ... both your Array formulas will produce accurate results ...
 
Upvote 0
That's the thing it doesn't - for another similar requirement the formula works perfectly but for this one it doesn't.

Could the fact that there are blank cells affect the outcome - could the formula be converting the blanks to a 0 which could affect the average?
 
Upvote 0
That's the thing it doesn't - for another similar requirement the formula works perfectly but for this one it doesn't.

Could the fact that there are blank cells affect the outcome - could the formula be converting the blanks to a 0 which could affect the average?

The blank cells are excluded from your Array formula ... so they do not interfere with the calculation ...

There is somewhere ... another reason for your discrepancy ...

For example ... Are you 100% sure the letter K is ' clean ' with no spaces before or after the letter ...
 
Upvote 0
Nope double checked no spaces before or after. Think I'll just create a helper column with a Y wherever there is a K or an E as I need to finish this off today but thank you again James006 for all your help.
 
Upvote 0

Forum statistics

Threads
1,215,809
Messages
6,127,012
Members
449,351
Latest member
Sylvine

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