AVERAGEIF - Why one works but another doesn't

Domski

Well-known Member
Joined
Jan 18, 2005
Messages
7,292
Hi there,

Just trying to get my head around something, more out of curiosity than anything else.

I'm using this formula to get averages based on 2 criteria:

{=AVERAGE(IF(Leave_Group=B$3,IF(Leave_Days>0,Leave_Days)))}

Which works fine.

I'm not a great fan of nested IF statements so assumed you'd be able to do the same thing using:

{=AVERAGE(IF(AND(Leave_Group=B$3,Leave_Days>0),Leave_Days))}

But it doesn't work.

Can anyone explain why?
 

Excel Facts

Links? Where??
If Excel says you have links but you can't find them, go to Formulas, Name Manager. Look for old links to dead workbooks & delete.
What are the defintions of Leave_Group and Leave_Days precisely?
 
Upvote 0
Hi,

Sorry, they're just named ranges that I use.

Leave Group = Leavers!$D$2:$D$3129

Leave Days = Leavers!$N$2:$N$3129
 
Upvote 0
Dom,

I don't know why AND doesn't work, but without the other IF,

{=AVERAGE(IF((Leave_Group=B$3)*(Leave_Days>0),Leave_Days))}
 
Upvote 0

Forum statistics

Threads
1,217,382
Messages
6,136,238
Members
450,000
Latest member
jgp19

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