+ Reply to Thread
Results 1 to 8 of 8

Average without counting zero’s

  1. #1
    Forum Contributor
    Join Date
    10-31-2006
    Location
    Oslo, Norway
    MS-Off Ver
    MS 365 Business
    Posts
    286

    Average without counting zero’s

    I want to calculate the average of, let’s say, four cells.
    Basic.
    But if one or more cells in the range are zero, I don’t want these cells to a part of the calculation.
    How could the formula be constructed ?

    Saturn
    Last edited by Saturn; 07-10-2011 at 10:15 AM.

  2. #2
    Forum Expert
    Join Date
    12-03-2009
    Location
    Florence, Italy
    MS-Off Ver
    Excel 2019
    Posts
    1,796

    Re: Average without counting zero’s

    Hi, an array formula

    =AVERAGE(IF(A1:A100,A1:A100))
    to be confirmed with control+shift+enter.

    Regards

    Edit: I'd left a ";" in the formula.
    Last edited by canapone; 07-10-2011 at 10:15 AM.

  3. #3
    Forum Contributor
    Join Date
    10-31-2006
    Location
    Oslo, Norway
    MS-Off Ver
    MS 365 Business
    Posts
    286

    Re: Average without counting zero’s

    Great!! An array is the solution.
    It works.
    Thanks a lot

  4. #4
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: Average without counting zero’s

    =sum(a1:a100)/countif(a1:a100,"<>"&0)
    "Unless otherwise stated all my comments are directed at OP"

    Mojito connoisseur and now happily retired
    where does code go ?
    look here
    how to insert code

    how to enter array formula

    why use -- in sumproduct
    recommended reading
    wiki Mojito

    how to say no convincingly

    most important thing you need
    Martin Wilson: SPV
    and RSMBC

  5. #5
    Forum Contributor
    Join Date
    10-31-2006
    Location
    Oslo, Norway
    MS-Off Ver
    MS 365 Business
    Posts
    286

    Re: Average without counting zero’s

    Thanks again
    The last one is good if the cells actually contains zero's and is not just blank.
    Another good option.

    Saturn

  6. #6
    Forum Expert daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    2016
    Posts
    14,675

    Re: Average without counting zero’s

    You can also use AVERAGEIF function

    =AVERAGEIF(A1:A4,"<>0")
    Audere est facere

  7. #7
    Registered User
    Join Date
    08-24-2011
    Location
    Pensacola, Florida
    MS-Off Ver
    Excel 2010
    Posts
    7

    Re: Average without counting zero’s

    I have all most the same problem. I'm trying to average a value in b2 plus a different sheet (bills) c2:ab2 and not average in cells that contain a zero. Here is how I have the formula:
    =averageif(b2,bills!c2:ab2,"<>0") what I get is a dialog box saying error in formula and it highlights b2 in the formula. If I remove b2 from the formula it works.
    =averageif(bills!c2:ab2,"<>0") . Any idea on whats going on?

    jim
    Last edited by jlr4; 08-24-2011 at 05:28 PM.

  8. #8
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: Average without counting zero’s

    you should start your own thread linking to this one if needed

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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