AVERAGEIF(column,"<>0) giving error #DIV/0!

msmith3

New Member
Joined
Feb 1, 2022
Messages
8
Office Version
  1. 2013
Platform
  1. Windows
I have a table with 20 rows and only 6 rows have data in them. I'm trying to get the average of only the rows containing data in a column. Can anyone help me figure out why I'm getting an error on this formula?

Example:
Sam5
Jess2
Dean4
Michael4
 

Excel Facts

Shade all formula cells
To shade all formula cells: Home, Find & Select, Formulas to select all formulas. Then apply a light fill color.
try this
Excel Formula:
=AVERAGEIF(C2:C20,"<>0",C2:C20)
 
Upvote 0
If the cells are really blank you could just use the AVERAGE function.

Book1
AB
1Data
25
36
4
53
65
7
875.2
Sheet1
Cell Formulas
RangeFormula
B8B8=AVERAGE(A2:A8)
 
Upvote 0
If the cells are really blank you could just use the AVERAGE function.

Book1
AB
1Data
25
36
4
53
65
7
875.2
Sheet1
Cell Formulas
RangeFormula
B8B8=AVERAGE(A2:A8)
I guess the cells aren't really blank because neither reply is working for it. The cells have a formula in them that is returning a blank value, does that change what the average formula should look like?
 
Upvote 0
What's the formula in those cells? If it's like

Excel Formula:
=IF(A1="Y","5","")

then that means it's returning a text version of the 5, which the AVERAGE or AVERAGEIF will ignore. Change it to:

Excel Formula:
=IF(A1="Y",5,"")

If that's not it, please show the formula you're using.
 
Upvote 0
What's the formula in those cells? If it's like

Excel Formula:
=IF(A1="Y","5","")

then that means it's returning a text version of the 5, which the AVERAGE or AVERAGEIF will ignore. Change it to:

Excel Formula:
=IF(A1="Y",5,"")

If that's not it, please show the formula you're using.
Table.png

The formula shown in the bar is what I have in every cell for column Q1, I'm trying to get the average of Q1 in cell D8 which currently says "N/A".
 
Upvote 0
change the
Excel Formula:
LEFT(Y38,1)

to
Excel Formula:
VALUE(LEFT(Y38,1))
 
Upvote 0
LEFT is a text function, and will always return a text value. And Average ignores text values. There are a few ways around it. If you are sure that you're always going to get a number from the LEFT function, you can change that formula to:

=IF(ISBLANK(B38),"",LEFT(Y38,1)+0)

Performing a math operation on a number saved as text, will convert it to a number. But if it's not a number, you'll get an error.
 
Upvote 0
Solution
LEFT is a text function, and will always return a text value. And Average ignores text values. There are a few ways around it. If you are sure that you're always going to get a number from the LEFT function, you can change that formula to:

=IF(ISBLANK(B38),"",LEFT(Y38,1)+0)

Performing a math operation on a number saved as text, will convert it to a number. But if it's not a number, you'll get an error.
You're a life saver, thank you!!!
 
Upvote 0

Forum statistics

Threads
1,214,926
Messages
6,122,306
Members
449,079
Latest member
juggernaut24

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