+ Reply to Thread
Results 1 to 3 of 3

Excluding zeros from average calculation

  1. #1
    Registered User
    Join Date
    03-26-2012
    Location
    Hull, England
    MS-Off Ver
    Excel 2010
    Posts
    8

    Excluding zeros from average calculation

    I have the following Excel macro for calculating the average for a range of cells:

    Please Login or Register  to view this content.
    I need to amend the code to exclude cells with a "0" value from the average.

    So, if I have 2, 2, 0, 2 in my cells, the current code calculates the average as 1.5, whereas I need it to ignore the zero and calculate as 2.

    I've been looking on the web for answers but am out of my depth. Would anyone please be able to help?

  2. #2
    Forum Expert sweep's Avatar
    Join Date
    04-03-2007
    Location
    Great Sankey, Warrington, UK
    MS-Off Ver
    2003 / 2007 / 2010 / 2016 / 365
    Posts
    3,440

    Re: Excluding zeros from average calculation

    Hi,

    Could you use something like this?

    Please Login or Register  to view this content.
    Rule 1: Never merge cells
    Rule 2: See rule 1

    "Tomorrow I'm going to be famous. All I need is a tennis racket and a hat".

  3. #3
    Registered User
    Join Date
    03-26-2012
    Location
    Hull, England
    MS-Off Ver
    Excel 2010
    Posts
    8

    Re: Excluding zeros from average calculation

    Works a charm, thanks so much.

+ 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. average column excluding zeros?
    By Willardio in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 04-21-2013, 08:40 PM
  2. [SOLVED] Average for non-consecutive cells excluding zeros (even when they all contain zeros)
    By pao13 in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 11-05-2012, 04:32 PM
  3. Array average excluding zeros
    By ChrisNor in forum Excel General
    Replies: 5
    Last Post: 12-06-2010, 08:55 AM
  4. average over worksheets excluding zeros
    By sccottt in forum Excel General
    Replies: 16
    Last Post: 12-18-2009, 01:13 PM
  5. Calculating the Average of Every Nth Value, Excluding Zeros
    By tsaravan in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 08-31-2006, 06:24 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