# How can I fix my #DIV/0 outcome?

#### artful

##### New Member
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

What is the fastest way to copy a formula?
If A2:A50000 contain data. Enter a formula in B2. Select B2. Double-click the Fill Handle and Excel will shoot the formula down to B50000.

#### barry houdini

##### MrExcel MVP
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)))

#### Aladin Akyurek

##### MrExcel MVP
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))))))}

#### artful

##### New Member
Thanks for your answers guys. really appreciate it.

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

#### Aladin Akyurek

##### MrExcel MVP
Thanks for your answers guys. really appreciate it.

I was able to use Barry's answer
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)))))}

#### artful

##### New Member
Thanks Aladin, that did the trick.

bedankt

Replies
3
Views
347
Replies
2
Views
213
Replies
3
Views
158
Replies
3
Views
689
Replies
2
Views
103

Threads
1,136,262
Messages
5,674,708
Members
419,520
Latest member
Jennifer4Dillon

### 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

### 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