+ Reply to Thread
Results 1 to 8 of 8

AVERAGEIFS with multiple criteria on one range

  1. #1
    Registered User
    Join Date
    07-14-2011
    Location
    Seattle, WA, USA
    MS-Off Ver
    Excel 2007
    Posts
    4

    AVERAGEIFS with multiple criteria on one range

    I have an AVERAGEIFS statement that I need to take two different criteria on one range. From the looks of it on Microsoft's site, I should be able to do it. Yet when I try it, I get the good ol' #DIV/0! error.

    The statement is as follows (they way I thought it would work, anyway):

    =AVERAGEIFS(J:J,F:F,"Inactive",D:D,"Equity",D:D,"Fixed Income")


    ...It works fine if I only have one of the D column criteria (either one of them), but not with both. Can I not put multiple criteria on the same column range in an AVERAGEIFS? If not, could someone please suggest another way of doing this. I basically need to get the average of the values in the J column of all rows left after those three criteria are met.

    Thanks in advance!
    Last edited by NBVC; 07-16-2011 at 11:23 PM.

  2. #2
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: AVERAGEIFS with multiple criteria on one range

    Averageifs works on AND conditions, not OR conditions...

    You are asking for average if D:D = Equity or if D:D = "Income"

    Try:

    =AVERAGE(IF((F1:F100="Inactive")*(D1:D100={"Equity","Fixed Income"},J1:J100))

    adjust ranges to suit (avoid whole columns or large ranges) and confirm with CTRL+SHIFT+ENTER not just ENTER

    or you can use:

    =SUM(SUMIFS(J:J,F:F,"Inactive",D:D,{"Equity","Fixed Income"}))/SUM(COUNTIFS(F:F,"Inactive",D:D,{"Equity","Fixed Income"}))

    where you can use whole columns and only confirm with Enter
    Last edited by NBVC; 07-14-2011 at 09:21 PM.
    Where there is a will there are many ways.

    If you are happy with the results, please add to the contributor's reputation by clicking the reputation icon (star icon) below left corner

    Please also mark the thread as Solved once it is solved. Check the FAQ's to see how.

  3. #3
    Registered User
    Join Date
    07-14-2011
    Location
    Seattle, WA, USA
    MS-Off Ver
    Excel 2007
    Posts
    4

    Re: AVERAGEIFS with multiple criteria on one range

    Thank you NBVC. I will try this first thing in the morning when I get back to the office.

    The part about it accepting AND and not OR makes sense, and I was wondering if that may be it.

  4. #4
    Registered User
    Join Date
    07-14-2011
    Location
    Seattle, WA, USA
    MS-Off Ver
    Excel 2007
    Posts
    4

    Re: AVERAGEIFS with multiple criteria on one range

    The AVERAGEIFS solution that you gave worked perfectly!

    Thanks for the help!

  5. #5
    Forum Contributor tangcla's Avatar
    Join Date
    06-04-2008
    Location
    Melbourne, Australia
    MS-Off Ver
    2010
    Posts
    136

    Re: AVERAGEIFS with multiple criteria on one range

    Hi NBVC: is it possible, for the above example, to have an average if statement where there are two arrays, for example if D:D = "Equity" or "Income", and if F:F = "Active" or "Inactive"?

  6. #6
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: AVERAGEIFS with multiple criteria on one range

    Yes it is. Just add the conditions after the F:F criteria range wiring curly brackets like the D:D range.

  7. #7
    Registered User
    Join Date
    04-23-2020
    Location
    India
    MS-Off Ver
    2016
    Posts
    1

    Re: AVERAGEIFS with multiple criteria on one range

    Hi, I would need your help with AVERAGEIFS:
    I have two criteria and using the following formula though, it's not working, tried the one shared by you as well with little tweaks, no success.
    =AVERAGEIFS(J4:J303,F4:F303,"XXXX",F4:F303,"YYYY")
    =AVERAGE(IF(F4:F303={"XXXX","YYYY"},J4:J303))

  8. #8
    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
    52,929

    Re: AVERAGEIFS with multiple criteria on one range

    Quote Originally Posted by T.T View Post
    Hi, I would need your help with AVERAGEIFS:
    I have two criteria and using the following formula though, it's not working, tried the one shared by you as well with little tweaks, no success.
    =AVERAGEIFS(J4:J303,F4:F303,"XXXX",F4:F303,"YYYY")
    =AVERAGE(IF(F4:F303={"XXXX","YYYY"},J4:J303))
    Administrative Note:

    Welcome to the forum.

    We are happy to help, however whilst you feel your request is similar to this thread, experience has shown that things soon get confusing when answers refer to particular cells/ranges/sheets which are unique to your post and not relevant to the original.

    Please see Forum Rule #4 about hijacking and start a new thread for your query.

    If you are not familiar with how to start a new thread see the FAQ: How to start a new thread
    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)

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