IF(IS ERROR with Array Formula

JOHANNA

New Member
Joined
May 12, 2005
Messages
39
I have an array formula that calculates the average of a column if two other columns meet a certain criteria (company department and year).

=Average(IF(dBaseMaster!$DO$2:$DO$81="HR",IF(Year(dBaseMaster!AH2:AH81)=2010,dBaseMaster!DN2:DN81))),0,Average(IF(dBaseMaster!$DO$2:$DO$81="HR",IF(Year(dBaseMaster!AH2:AH81)=2010,dBaseMaster!DN2:DN81)))

I get a DIV/0 error when the criteria isn't met. I tried to add an IF(IS ERROR in the front of the formula, but it says that there is an error and highlights the ,0, in the middle of the formula.

Any ideas?
 

Excel Facts

Return population for a City
If you have a list of cities in A2:A100, use Data, Geography. Then =A2.Population and copy down.
I have an array formula that calculates the average of a column if two other columns meet a certain criteria (company department and year).

=Average(IF(dBaseMaster!$DO$2:$DO$81="HR",IF(Year(dBaseMaster!AH2:AH81)=2010,dBaseMaster!DN2:DN81))),0,Average(IF(dBaseMaster!$DO$2:$DO$81="HR",IF(Year(dBaseMaster!AH2:AH81)=2010,dBaseMaster!DN2:DN81)))

I get a DIV/0 error when the criteria isn't met. I tried to add an IF(IS ERROR in the front of the formula, but it says that there is an error and highlights the ,0, in the middle of the formula.

Any ideas?
What version of Excel are you using?
 
Upvote 0
Okay, I feel like an idiot. I had a parenthesis in the wrong spot. Here is the correction if anyone finds it helpful.

=IF(ISERROR(AVERAGE(IF(dBaseMaster!$DO$2:$DO$81="SC-I",IF(YEAR(dBaseMaster!AH2:AH81)=2010,dBaseMaster!DN2:DN81)))),0,(AVERAGE(IF(dBaseMaster!$DO$2:$DO$81="SC-I",IF(YEAR(dBaseMaster!AH2:AH81)=2010,dBaseMaster!DN2:DN81)))))


This is an array so CTRL + SHIFT + Enter to calculate
 
Upvote 0
Okay, I feel like an idiot. I had a parenthesis in the wrong spot. Here is the correction if anyone finds it helpful.

=IF(ISERROR(AVERAGE(IF(dBaseMaster!$DO$2:$DO$81="SC-I",IF(YEAR(dBaseMaster!AH2:AH81)=2010,dBaseMaster!DN2:DN81)))),0,(AVERAGE(IF(dBaseMaster!$DO$2:$DO$81="SC-I",IF(YEAR(dBaseMaster!AH2:AH81)=2010,dBaseMaster!DN2:DN81)))))


This is an array so CTRL + SHIFT + Enter to calculate
Since you want a result of 0 this is more efficient and a few keystrokes shorter:

Still array entered.

=LOOKUP(1E100,CHOOSE({1,2},0,AVERAGE(IF(dBaseMaster!$DO$2:$DO$81="SC-I",IF(YEAR(dBaseMaster!AH2:AH81)=2010,dBaseMaster!DN2:DN81)))))
 
Upvote 0
I have an array formula that calculates the average of a column if two other columns meet a certain criteria (company department and year).

=Average(IF(dBaseMaster!$DO$2:$DO$81="HR",IF(Year(dBaseMaster!AH2:AH81)=2010,dBaseMaster!DN2:DN81))),0,Average(IF(dBaseMaster!$DO$2:$DO$81="HR",IF(Year(dBaseMaster!AH2:AH81)=2010,dBaseMaster!DN2:DN81)))

I get a DIV/0 error when the criteria isn't met. I tried to add an IF(IS ERROR in the front of the formula, but it says that there is an error and highlights the ,0, in the middle of the formula.

Any ideas?

Try...
Code:
=LOOKUP(9.99999999999999E+307,CHOOSE({1,2},0,
    AVERAGE(IF(dBaseMaster!$DO$2:$DO$81="HR",
      IF(YEAR(dBaseMaster!AH2:AH81)=2010,dBaseMaster!DN2:DN81)))))
 
Upvote 0

Forum statistics

Threads
1,224,557
Messages
6,179,508
Members
452,918
Latest member
Davion615

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