+ Reply to Thread
Results 1 to 4 of 4

How to define multiple ranges with AVERAGEIF().

  1. #1
    Registered User
    Join Date
    04-12-2013
    Location
    Sweden
    MS-Off Ver
    Excel 2007
    Posts
    30

    Smile How to define multiple ranges with AVERAGEIF().

    Hi all!
    I have a little problem with a formula in a work document.

    It is a document that shows figures for each day of the year with week, month and year total summaries. Some columns in this document calculates averages.

    For the Weekly summaries i am using the following formula:
    =IFERROR(IF(COUNT(B1,B4,B5,B6,B7,B8,B9),AVERAGEIF((B1:B4:B9),"<>0"),0),0)

    This is for two reason:
    1. I don't want the #DIV/0! error to be displayed when the average is calculated for empty cells so that the week, month and year totals always displays values.
    2. I want "0" and blank cells to be excluded from the calculations.

    The problem i have is that when a week spans two months, the RANGE in the formula must be split into two (because the month summary is in between) and for the "IF(COUNT" part in the above formula i can just use commas to define each cell instead of two ranges.
    BUT, i cannot find a way to define multiple cells or ranges with "AVERAGEIF". I tried using commas as with COUNT and i also tried using it with "AVERAGEIF((B1:B4;B9)" which gave an error and suggested me to change it to "B1:B4:B9" which doesn't calculate correctly.

    See the example file attached.

    I really hope someone has a good solution or info to point out what i might be doing wrong
    Also, if suggesting an entirely different kind of formula, the important steps are:
    1. Calculate Average excluding "0" and blank cells.
    2. Show a value of "0" if an error is the result.
    3. Be able to define multiple cells or ranges.
    Attached Files Attached Files

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

    Re: How to define multiple ranges with AVERAGEIF().

    Well the average is 28.6
    =AVERAGEIFS(B1:B9,A1:A9,">="&A1,A1:A9,"<="&A9) gives that result
    "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

  3. #3
    Registered User
    Join Date
    10-05-2017
    Location
    Milwaukee
    MS-Off Ver
    2016
    Posts
    15

    Re: How to define multiple ranges with AVERAGEIF().

    What if he had multiple ranges he wanted to average? How would he go about do that? What if he had more data he wanted to get averages on in columns C & D? Thanks

  4. #4
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    53,048

    Re: How to define multiple ranges with AVERAGEIF().

    mjac101 welcome to the forum

    Unfortunately your post does not comply with Rule 2 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 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.
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

+ 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. AVERAGEIF for multiple ranges
    By soccow in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 09-17-2012, 06:58 PM
  2. [SOLVED] AVERAGEIF / SUMIF with multiple ranges
    By xandermacleod in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 09-13-2012, 01:26 PM
  3. Macro to define names for multiple ranges
    By pedrofogao21 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 04-11-2012, 12:12 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. Using Cells Method to define Ranges
    By johnhildreth@citynet.net in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 02-23-2006, 12:10 PM

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