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

Copy a format multiple times
Select a formatted range. Double-click the Format Painter (left side of Home tab). You can paste formatting multiple times. Esc to stop
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,224,730
Messages
6,180,607
Members
452,991
Latest member
JM_000888

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