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?
 

Some videos you may like

Excel Facts

Back into an answer in Excel
Use Data, What-If Analysis, Goal Seek to find the correct input cell value to reach a desired result

GlennUK

Well-known Member
Joined
Jul 8, 2002
Messages
11,402
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,458
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))}
 

Watch MrExcel Video

Forum statistics

Threads
1,114,093
Messages
5,545,917
Members
410,711
Latest member
Josh324
Top