+ Reply to Thread
Results 1 to 10 of 10

Averageif, not counting zeros, but in multiple ranges)

  1. #1
    Registered User
    Join Date
    01-15-2015
    Location
    California
    MS-Off Ver
    2010
    Posts
    96

    Thumbs up Averageif, not counting zeros, but in multiple ranges)

    I need to return an average for the following ranges E5, E9:13, E17:21, E25:29, E34:37 only and not count any zeros. I have tried multiple options with sum/countif, averageif, etc., and I must be missing something. If there a solution? TIA
    Last edited by Alphabex; 05-15-2015 at 01:18 PM.

  2. #2
    Forum Expert Sam Capricci's Avatar
    Join Date
    06-14-2012
    Location
    Palm Harbor, Florida
    MS-Off Ver
    16.84 for Mac MS 365
    Posts
    8,499

    Re: Averageif, not counting zeros, but in multiple ranges)

    have you just tried =AVERAGE(E5, E9:E13, E17:E21, E25:E29, E34:E37)? The average function ignores blanks.

    corrected for clarity
    Make contributors happy, click on the "* Add Reputation" as a way to say thank you.
    Sam Capricci

  3. #3
    Registered User
    Join Date
    01-15-2015
    Location
    California
    MS-Off Ver
    2010
    Posts
    96

    Re: Averageif, not counting zeros, but in multiple ranges)

    Yes, I want it to ignore zeros, not blanks.

  4. #4
    Forum Expert Sam Capricci's Avatar
    Join Date
    06-14-2012
    Location
    Palm Harbor, Florida
    MS-Off Ver
    16.84 for Mac MS 365
    Posts
    8,499

    Re: Averageif, not counting zeros, but in multiple ranges)

    I tried this on some data with zeros and blanks and it appeared to work, maybe you can adapt it to your range?
    =AVERAGEIF(H583:H590,"<>0",H583:H590)

    EDIT: and it also works without the second range... =AVERAGEIF(H583:H590,"<>0")

  5. #5
    Registered User
    Join Date
    01-15-2015
    Location
    California
    MS-Off Ver
    2010
    Posts
    96

    Re: Averageif, not counting zeros, but in multiple ranges)

    it does not work because I have multiple ranges that I want to include. (E5, E9:E13, E17:E21, E25:E29, E34:E37)

  6. #6
    Forum Expert Sam Capricci's Avatar
    Join Date
    06-14-2012
    Location
    Palm Harbor, Florida
    MS-Off Ver
    16.84 for Mac MS 365
    Posts
    8,499

    Re: Averageif, not counting zeros, but in multiple ranges)

    without seeing your data this is the latest I could come up with that works in my sample data. I know the items included are contiguous but they were entered as ranges, see if it works for your ranges...
    =SUM(E5,E9:E13,E17:E21,E25:E29,E34:E37)/(COUNTIF(E5,"<>0")+COUNTIF(E9:E13,"<>0")+COUNTIF(E17:E21,"<>0")+COUNTIF(E25:E29,"<>0")+COUNTIF(E34:E37,"<>0"))

    EDITed, adjusted to your ranges.
    Last edited by Sam Capricci; 05-14-2015 at 06:55 PM.

  7. #7
    Registered User
    Join Date
    01-15-2015
    Location
    California
    MS-Off Ver
    2010
    Posts
    96

    Re: Averageif, not counting zeros, but in multiple ranges)

    Victory!!!!!!!! I need to remember this formula, I will use it many times. Thank you!

  8. #8
    Forum Expert Sam Capricci's Avatar
    Join Date
    06-14-2012
    Location
    Palm Harbor, Florida
    MS-Off Ver
    16.84 for Mac MS 365
    Posts
    8,499

    Re: Averageif, not counting zeros, but in multiple ranges)

    Great, glad that worked for you. If solved please mark your post as solved using the thread tools dropdown at the top of the post.
    and if you're inclined clicking on *Add Reputation helps us advance on this forum.

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

    Re: Averageif, not counting zeros, but in multiple ranges)

    Quote Originally Posted by Sambo kid View Post
    =SUM(E5,E9:E13,E17:E21,E25:E29,E34:E37)/(COUNTIF(E5,"<>0")+COUNTIF(E9:E13,"<>0")+COUNTIF(E17:E21,"<>0")+COUNTIF(E25:E29,"<>0")+COUNTIF(E34:E37,"<>0"))
    Your ranges need to be fully populated (with numbers) for that formula to work, though, because blank cells, for example, will be counted by the COUNTIF functions


    This version will work assuming you don't need to accommodate negative values, will also handle blanks

    =SUM(E5,E9:E13,E17:E21,E25:E29,E34:E37)/INDEX(FREQUENCY((E5,E9:E13,E17:E21,E25:E29,E34:E37),0),2)

    It's possible, if you want, to give your discontiguous ranges a single name, and then use the name only, i.e.

    =SUM(Range1)/INDEX(FREQUENCY(Range1,0),2)
    Audere est facere

  10. #10
    Registered User
    Join Date
    01-08-2022
    Location
    USA
    MS-Off Ver
    2007
    Posts
    1

    Re: Averageif, not counting zeros, but in multiple ranges)

    I've been trying to find something like this for weeks. VICTORY! Although it's 6.5 years later, I appreciate finding this! THANK YOU!!

+ 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. How to define multiple ranges with AVERAGEIF().
    By Snoddas in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 06-24-2018, 11:50 PM
  2. AVERAGEIF for multiple ranges
    By soccow in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 09-17-2012, 06:58 PM
  3. [SOLVED] AVERAGEIF / SUMIF with multiple ranges
    By xandermacleod in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 09-13-2012, 01:26 PM
  4. SUMIF/AVERAGEIF with multiple ranges
    By Cassi in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 03-04-2011, 11:10 AM
  5. AverageIf Formula Counting zeros grrr
    By AllenMead in forum Excel General
    Replies: 3
    Last Post: 10-31-2010, 11:41 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