How do I average multiple columns (ignoring zeros and blank cells)?

yeto

New Member
Joined
Mar 1, 2012
Messages
32
Office Version
  1. 2010
Platform
  1. Windows
I am trying to average multiple columns (ignoring zeros and blank cells). I have tried the following formulas. Neither is working. Could someone share as to what I may be dong incorrectly?

=iferrors(AVERAGEIF(E3:E18,J3:J18,">0"),0)
=iferrors(AVERAGEIFs(E3:E18,J3:J18,">0"),0)

Thank you in advance for any help,
yeto
 
AVERAGEIF doesn't work on disconious ranges. You have to handle it piece by piece.

=(SUMIF(E3:E18,">0")+SUMIF(J3:J18,">0")) / (COUNTIF(E3:E18,">0")+COUNTIF(J3:J18,">0"))

That works very nicely. Is it possible to get rid of #DIV/0! if all cells are blank or zero? It would be okay if the box said some like "needs input" or something similar just as long as people using the spreadsheet don't feel they need to divide something or however they might interpret #DIV/0! (if the results box just show "blank" that would be okay as well).

Again, thank you for taking time out of your day to help,
yeto
 
Last edited:
Upvote 0

Excel Facts

Repeat Last Command
Pressing F4 adds dollar signs when editing a formula. When not editing, F4 repeats last command.
with Power Query
View attachment 5447
Code:
let
    Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
    Expand = Table.ExpandListColumn(Table.FromList(Table.ToColumns(Source), Splitter.SplitByNothing(), null, null, ExtraValues.Error), "Column1"),
    Result = #table(1, {{List.Average(Table.SelectRows(Expand, each ([Column1] <> null and [Column1] <> 0))[Column1])}}),
    Rename = Table.RenameColumns(Result,{{"Column1", "Average"}})
in
    Rename
This looks very nice but way over my head. I will have to Google and learn Power Query for future use.

Thank you for helping,
yeto
 
Upvote 0

Attachments

  • test excel photo3.JPG
    test excel photo3.JPG
    60.4 KB · Views: 11
Upvote 0
You are missing the second argument of the IFERROR function.
Excel's built in HELP will explain how to use the IFERROR function.
 
Upvote 0
You are missing the second argument of the IFERROR function.
Excel's built in HELP will explain how to use the IFERROR function.
Thank you. I will study. I appreciate all your help.

Thank you,
yeto
 
Upvote 0

Forum statistics

Threads
1,214,821
Messages
6,121,755
Members
449,049
Latest member
excelknuckles

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