Average

kcdill

Board Regular
Joined
Mar 13, 2002
Messages
106
I am trying to average the values in B38:I38 in eight adjacent columns. The eight cells are linked to eight different spreadsheets. I am using the formula =SUM(SUMIF(B38:I38,{"<0",">0"}))/COUNT(B38:I38). This formula works ok if all eight cells have a value. But when the cell only contains the link formula and no number value the formula wants to divide by eight even if only two cells contain number values. This formula seemed to work in a different spreadsheet but doesn't want to work today. Thanks for your help.
 

Excel Facts

Get help while writing formula
Click the italics "fx" icon to the left of the formula bar to open the Functions Arguments dialog. Help is displayed for each argument.

Datsmart

Well-known Member
Joined
Jun 19, 2003
Messages
7,985
I assume you are trying to Average without counting zeros.
If so, try this formula:
Code:
=SUM(B38:I38)/COUNTIF(B38:I38,">0")
 

kcdill

Board Regular
Joined
Mar 13, 2002
Messages
106
Good Morning DatSmart:
Your solution works great. One other question. When all eight of the cells are empty the formula returns #DIV/0!. What I would like to see is an empty cell. I tried =IF(I13<>"",SUM(B38:I38)/COUNTIF(B38:I38,">0"),"") but that had no effect. What can I add to your formula to return a blank cell? Thanks again for your help.
 

Diffy

Well-known Member
Joined
Dec 22, 2006
Messages
512
do this:
Code:
=if(iserror(SUM(B38:I38)/COUNTIF(B38:I38,">0")),"",SUM(B38:I38)/COUNTIF(B38:I38,">0"))
 

Datsmart

Well-known Member
Joined
Jun 19, 2003
Messages
7,985
Try this:
Code:
=IF(COUNT(B38:I38)=0,"",SUM(B38:I38)/COUNTIF(B38:I38,">0"))
 
Master Excel Bundle

Excel contains over 450 functions, with more added every year. That’s a huge number, so where should you start? Right here with this bundle.

Forum statistics

Threads
1,168,091
Messages
5,857,303
Members
431,870
Latest member
Muratculous

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
Top