#DIV/0 error when getting the average

L40

Board Regular
Joined
Mar 17, 2011
Messages
100
I have 2 work books, book1 and book2. I need help with a formula. When I have data in the cell it works great, but when there is no data I’m getting a #DIV/0 error.
Book 1 has this formula in it, but it is referencing book 2 that has multiple sheets in it. Example sheet1 through sheet 7
This is the formula I’m using.
=SUM('[book2.xlsx]sheet1:sheet7'!$B$65)/INDEX(FREQUENCY('[book2.xlsx]sheet1:sheet7'!$B$65,0),2)
Once again it works great when there is data. When no data is present I get #DIV/0 error. I have tried the following.
<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /><o:p></o:p>
=IF('[book2.xlsx]sheet1:sheet7'!$B$65=0,0,SUM('[book2.xlsx]sheet1:sheet7'!$B$65)/INDEX(FREQUENCY('[book2.xlsx]sheet1:sheet7'!$B$65,0),2))
With this formula I get #REF error. If I select just 1 sheet from the example above it works fine =IF('[book2.xlsx]sheet1'!$B$65=0,0,SUM('[book2.xlsx]sheet1:sheet2'!$B$65)/INDEX(FREQUENCY('[book2.xlsx]sheet1:sheet7'!$B$65,0),2))
I need the cell to be blank or 0 if there is no data. I hope I haven’t confused any one.
Thanks
 
Last edited:

Excel Facts

Create a chart in one keystroke
Select the data and press Alt+F1 to insert a default chart. You can change the default chart to any chart type
Untested

=IF(SUM('[book2.xlsx]sheet1:sheet2'!$B$65)=0,0,SUM('[book2.xlsx]sheet1:sheet2'!$B$65)/INDEX(FREQUENCY('[book2.xlsx]sheet1:sheet2'!$B$65,0),2))

Or as long as you don't need it to work with excel 2003 (or older)

=IFERROR(SUM('[book2.xlsx]sheet1:sheet7'!$B$65)/INDEX(FREQUENCY('[book2.xlsx]sheet1:sheet7'!$B$65,0),2),0)
 
Upvote 0
I have 2 work books, book1 and book2. I need help with a formula. When I have data in the cell it works great, but when there is no data I’m getting a #DIV/0 error.
Book 1 has this formula in it, but it is referencing book 2 that has multiple sheets in it. Example sheet1 through sheet 7
This is the formula I’m using.
=SUM('[book2.xlsx]sheet1:sheet7'!$B$65)/INDEX(FREQUENCY('[book2.xlsx]sheet1:sheet7'!$B$65,0),2)
Once again it works great when there is data. When no data is present I get #DIV/0 error. I have tried the following.
<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /><o:p></o:p>
=IF('[book2.xlsx]sheet1:sheet7'!$B$65=0,0,SUM('[book2.xlsx]sheet1:sheet2'!$B$65)/INDEX(FREQUENCY('[book2.xlsx]sheet1:sheet7'!$B$65,0),2))
With this formula I get #REF error. If I select just 1 sheet from the example above it works fine =IF('[book2.xlsx]sheet1'!$B$65=0,0,SUM('[book2.xlsx]sheet1:sheet2'!$B$65)/INDEX(FREQUENCY('[book2.xlsx]sheet1:sheet7'!$B$65,0),2))
I need the cell to be blank or 0 if there is no data. I hope I haven’t confused any one.
Thanks
Try...

=SUM('[book2.xlsx]sheet1:sheet7'!$B$65)/MAX(1,INDEX(FREQUENCY('[book2.xlsx]sheet1:sheet7'!$B$65,0),2))
 
Upvote 0
Untested

=IF(SUM('[book2.xlsx]sheet1:sheet2'!$B$65)=0,0,SUM('[book2.xlsx]sheet1:sheet2'!$B$65)/INDEX(FREQUENCY('[book2.xlsx]sheet1:sheet2'!$B$65,0),2))

Or as long as you don't need it to work with excel 2003 (or older)

=IFERROR(SUM('[book2.xlsx]sheet1:sheet7'!$B$65)/INDEX(FREQUENCY('[book2.xlsx]sheet1:sheet7'!$B$65,0),2),0)
COUNT would be a "safer" choice.

-10, 10 = 0
 
Upvote 0

Forum statistics

Threads
1,224,534
Messages
6,179,391
Members
452,909
Latest member
VickiS

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