+ Reply to Thread
Results 1 to 15 of 15

Average non-contiguous cells, ignore blank cells and avoid #DIV/0!

  1. #1
    Registered User
    Join Date
    08-21-2013
    Location
    Salisbury, UK
    MS-Off Ver
    Excel 2010
    Posts
    6

    Average non-contiguous cells, ignore blank cells and avoid #DIV/0!

    Hi everyone

    This is my first post, and I doubt I will contribute anything anytime soon as I am only as proficient at Excel as I need to be, which has been to a quite basic level. Now I need some help with a problem that my tiny brain cannot cope with.

    In Excel 2010, I am trying to average just three non-contiguous cells without leaving the dreaded #DIV/0! error, as it prevents some other cells from making their calculations. Some of the cells may be left blank, and the value may be entered into any one of the three cells to be valued i.e. I may need to place a value in the second cell and leave the others blank, but I still need the correct sum in the averaging cell, and don't want the #DIV/0! when they are all left blank.

    I hope this makes sense.

    Thanks for your time.

    David

  2. #2
    Forum Expert Ace_XL's Avatar
    Join Date
    06-04-2012
    Location
    UAE
    MS-Off Ver
    2016
    Posts
    6,074

    Re: Average non-contiguous cells, ignore blank cells and avoid #DIV/0!

    Maybe..

    =IFERROR(AVERAGE(A1,C1,E1),0)

    AVERAGE() ignores blank cells
    Life's a spreadsheet, Excel!
    Say thanks, Click *

  3. #3
    Forum Expert Ron Coderre's Avatar
    Join Date
    03-22-2005
    Location
    Boston, Massachusetts
    MS-Off Ver
    2013, 2016, O365
    Posts
    6,996

    Re: Average non-contiguous cells, ignore blank cells and avoid #DIV/0!

    Here's an approach to consider...

    With these non-contiguous cells SELECTED....A1, C1, E1

    • Formula.Name_Manager...Click: New
    ...Name: rngAvg
    ...Click: OK

    Now use this formula:
    =IFERROR(AVERAGE(rngAvg),0)

    Is that something you can work with?
    Ron
    Former Microsoft MVP - Excel (2006 - 2015)
    Click here to see the Forum Rules

  4. #4
    Registered User
    Join Date
    08-21-2013
    Location
    Salisbury, UK
    MS-Off Ver
    Excel 2010
    Posts
    6

    Re: Average non-contiguous cells, ignore blank cells and avoid #DIV/0!

    Thanks guys

    It works when I add a value to all three cells, but when I only use one or two cells, the average result is incorrect unfortunately. I know it may sound odd to want a an average formula when there might be only one or two cells used out of the three, but that is the nature of my work I'm afraid.

    It seems either I get the functionality I need but get the error message when the cells are blank or at zero, or the error message is removed, but the cells don not calculate right when only some have values.

    Sorry to be a pain.

  5. #5
    Forum Guru (RIP) Marcol's Avatar
    Join Date
    12-23-2009
    Location
    Fife, Scotland
    MS-Off Ver
    Excel '97 & 2003/7
    Posts
    7,216

    Re: Average non-contiguous cells, ignore blank cells and avoid #DIV/0!

    Try this where 3 is the number of cells to average
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    Is that what you mean?
    If you need any more information, please feel free to ask.

    However,If this takes care of your needs, please select Thread Tools from menu above and set this topic to SOLVED. It helps everybody! ....

    Also
    اس کی مدد کرتا ہے اگر
    شکریہ کہنے کے لئے سٹار کلک کریں
    If you are satisfied by any members response to your problem please consider using the small Star icon bottom left of their post to show your appreciation.

  6. #6
    Registered User
    Join Date
    08-21-2013
    Location
    Salisbury, UK
    MS-Off Ver
    Excel 2010
    Posts
    6

    Re: Average non-contiguous cells, ignore blank cells and avoid #DIV/0!

    Hi Marcol

    I don't think so, as I don't want to have to change the formula each time I vary the number of cells with a value (as I said before, can be one, two or all three with values or left blank). I'd like to have a formula that can take account of any number of blank or value cells, and return the correct result with having to edit it each time.

    Appreciate your help though.

  7. #7
    Forum Expert daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    Microsoft 365
    Posts
    14,677

    Re: Average non-contiguous cells, ignore blank cells and avoid #DIV/0!

    Quote Originally Posted by Davdef View Post
    It works when I add a value to all three cells, but when I only use one or two cells, the average result is incorrect unfortunately. I know it may sound odd to want a an average formula when there might be only one or two cells used out of the three, but that is the nature of my work I'm afraid.
    Can you give an example? If one of your cells is blank and the other two contain 5 and 7 what result do you expect?
    Audere est facere

  8. #8
    Registered User
    Join Date
    08-21-2013
    Location
    Salisbury, UK
    MS-Off Ver
    Excel 2010
    Posts
    6

    Re: Average non-contiguous cells, ignore blank cells and avoid #DIV/0!

    Hi daddylonglegs

    6 of course. I always want either the average of two or more values, or the equal of one cell if just one value is entered. It's to do with recording my workings out as much as anything, and removing human error as much as possible, hence the auto calculation of Excel seems ideal.

  9. #9
    Forum Expert daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    Microsoft 365
    Posts
    14,677

    Re: Average non-contiguous cells, ignore blank cells and avoid #DIV/0!

    OK but you said the average result was incorrect with 1 or 2 cells using Ace's formula

    =IFERROR(AVERAGE(A1,C1,E1),0)

    That formula gives me 6 with one cell blank and the other two containing 5 and 7. Can you give an example where you get the wrong result using that version?

    Are you trying to ignore zeroes too? If so try this version

    =SUM(A1,C1,E1)/MAX(1,(A1>0)+(C1>0)+(E1>0))
    Last edited by daddylonglegs; 08-21-2013 at 10:00 AM.

  10. #10
    Registered User
    Join Date
    08-21-2013
    Location
    Salisbury, UK
    MS-Off Ver
    Excel 2010
    Posts
    6

    Re: Average non-contiguous cells, ignore blank cells and avoid #DIV/0!

    Sure,

    G11 = 0, I11 = 5, J11 = 7 result(in K11) = 4

  11. #11
    Forum Expert daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    Microsoft 365
    Posts
    14,677

    Re: Average non-contiguous cells, ignore blank cells and avoid #DIV/0!

    ...and you want 6? The AVERAGE functions suggested ignore blanks (as you asked) but not zeroes. Try the version I suggested in my edit to last post, i.e.

    =SUM(G11,I11,J11)/MAX(1,(G11>0)+(I11>0)+(J11>0))

  12. #12
    Registered User
    Join Date
    08-15-2013
    Location
    Canada
    MS-Off Ver
    Excel 2010
    Posts
    16

    Re: Average non-contiguous cells, ignore blank cells and avoid #DIV/0!

    Try this

    =SUM(A1,C1,E1) / COUNT(A1,C1,E1)

    Or, because I'm not testing this out... not sure which will work...

    =SUM(A1,C1,E1) / ( COUNT(A1,C1,E1) - COUNTBLANK(A1,C1,E1) )

  13. #13
    Registered User
    Join Date
    08-21-2013
    Location
    Salisbury, UK
    MS-Off Ver
    Excel 2010
    Posts
    6

    Re: Average non-contiguous cells, ignore blank cells and avoid #DIV/0!

    Daddylonglegs

    You're the man! Sorry I missed that part of your post (probably didn't scroll down enough to see it)! And apologies if I didn't give you very precise information.

    Was beginning to think there was no solution to this problem, so a very big thank you for your perseverance.

    I am one happy Excel user (again).

  14. #14
    Registered User
    Join Date
    10-02-2018
    Location
    Germany
    MS-Off Ver
    2010
    Posts
    1

    Re: Average non-contiguous cells, ignore blank cells and avoid #DIV/0!

    A1 C1 F1 K1 V1
    1 ____ 0 ____ 2
    0 ____ 0 ____ 0

    I want to average these columns and display a result 0 if there is 0 or ____ in entire calculation.

    How can i do that for a row that has 0 and a blank? For second row it dispalys error if i use a formula.

  15. #15
    Forum Guru
    Join Date
    08-28-2014
    Location
    USA
    MS-Off Ver
    Excel 365 version 2501
    Posts
    18,815

    Re: Average non-contiguous cells, ignore blank cells and avoid #DIV/0!

    Unfortunately your post does not comply with Rule 4 of our Forum RULES. Do not post a question in the thread of another member -- start your own thread.

    If you feel an existing thread is particularly relevant to your need, provide a link to the other thread in your new thread.

    Old threads (this one has been dormant for over five years) are often only monitored by the original participants. New threads not only open you up to all possible participants again, they typically get faster response, too.
    Consider taking the time to add to the reputation of everybody that has taken the time to respond to your query.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. comparing cells that are non contiguous and seperated by blank cells
    By mz8l18 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 07-02-2013, 02:36 AM
  2. Replies: 5
    Last Post: 05-18-2013, 07:49 PM
  3. How can I make a macro ignore blank cells? - Blank Cells have formulas
    By mz1161 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 04-30-2013, 08:54 AM
  4. Average the last 10 cells of a dynamic column but ignore blank cells & 0
    By mattadler22 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 04-13-2013, 11:37 PM
  5. average formula for non contiguous range and eliminate blank cells
    By kkotter in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 03-28-2013, 10:13 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1