How can I fix my #DIV/0 outcome?

artful

New Member
Joined
Oct 21, 2006
Messages
3
I am calculating averages but get a nasty #DIV/0 outcome when part of my array is ZERO.

my forumla is: {=AVERAGE(IF(LEFT($W$3:$W$459,4)=J$462,IF($F$3:$F$459=$H464,IF($J$3:$J$459>0,$J$3:$J$459))))}

Can anyone suggest a solution?
 

Excel Facts

Select a hidden cell
Somehide hide payroll data in column G? Press F5. Type G1. Enter. Look in formula bar while you arrow down through G.
One way would be to use

=SUMPRODUCT(--(LEFT($W$3:$W$459,4)=J$462),--($F$3:$F$459=$H464),--($J$3:$J$459>0),$J$3:$J$459)/MAX(1,SUMPRODUCT(--(LEFT($W$3:$W$459,4)=J$462),--($F$3:$F$459=$H464),--($J$3:$J$459>0)))
 
Upvote 0
Also...

{=LOOKUP(9.99999999999999E+307,CHOOSE{1,2},0,AVERAGE(IF(LEFT($W$3:$W$459,4)=J$462,IF($F$3:$F$459=$H464,IF($J$3:$J$459>0,$J$3:$J$459))))))}
 
Upvote 0
Thanks for your answers guys. really appreciate it.

I was able to use Barry's answer :biggrin:
but I couldn't get Aladin's to work (came up with a error in formula 'CHOOSE').
 
Upvote 0
Thanks for your answers guys. really appreciate it.

I was able to use Barry's answer :biggrin:
but I couldn't get Aladin's to work (came up with a error in formula 'CHOOSE').

Probably because of a missing paren...

{=LOOKUP(9.99999999999999E+307,CHOOSE({1,2},0,AVERAGE(IF(LEFT($W$3:$W$459,4)=J$462,IF($F$3:$F$459=$H464,IF($J$3:$J$459>0,$J$3:$J$459)))))}
 
Upvote 0

Forum statistics

Threads
1,215,043
Messages
6,122,812
Members
449,095
Latest member
m_smith_solihull

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