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

How can you turn a range sideways?
Copy the range. Select a blank cell. Right-click, Paste Special, then choose Transpose.

GlennUK

Well-known Member
Joined
Jul 8, 2002
Messages
11,723
What are the defintions of Leave_Group and Leave_Days precisely?
 

Domski

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

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

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

Leave Days = Leavers!$N$2:$N$3129
 

Brian from Maui

MrExcel MVP
Joined
Feb 16, 2002
Messages
8,459
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))}
 

Forum statistics

Threads
1,176,226
Messages
5,902,023
Members
434,934
Latest member
brendalpzm

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
Top