+ Reply to Thread
Results 1 to 6 of 6

Averageifs with OR criteria

  1. #1
    Registered User
    Join Date
    12-22-2011
    Location
    Berlin, Germany
    MS-Off Ver
    Excel 2010
    Posts
    58

    Averageifs with OR criteria

    I have a spreadsheet attached. Basically, I have 4 products - A, B, C, and D. Their production rates are shown in column B. I need to take the average of both A and B's rates together in a single cell.

    I've tried
    =AVERAGEIFS(rates column, product names, "A", product names, "B")
    or...
    =AVERAGEIFS(rates column, product names, OR("A","B"))

    Unsuccessful.

    The method using sumif/countif works, but it's too bulky. There must be a way to do this with averageifs.

    Any ideas would be appreciated. Thanks.
    Attached Files Attached Files

  2. #2
    Forum Contributor
    Join Date
    05-14-2010
    Location
    Mumbai, India
    MS-Off Ver
    Excel 2007
    Posts
    187

    Re: Averageifs with OR criteria

    Just use Averageif for A and B just sum them that should work

  3. #3
    Forum Contributor
    Join Date
    05-14-2010
    Location
    Mumbai, India
    MS-Off Ver
    Excel 2007
    Posts
    187

    Re: Averageifs with OR criteria

    Code for Cell I3 in your Sheet

    Code: =(AVERAGEIF($A$2:$A$12,E2,$B$2:$B$12)+AVERAGEIF($A$2:$A$12,E3,$B$2:$B$12))/2

  4. #4
    Registered User
    Join Date
    12-22-2011
    Location
    Berlin, Germany
    MS-Off Ver
    Excel 2010
    Posts
    58

    Re: Averageifs with OR criteria

    Summation and division of the averages will only work if there are an equal number of terms per product.

  5. #5
    Forum Contributor
    Join Date
    05-14-2010
    Location
    Mumbai, India
    MS-Off Ver
    Excel 2007
    Posts
    187

    Re: Averageifs with OR criteria

    Didn't get what you are trying to say. Do you mean that if number of A's are 3 and number of B's are 2 then the code mentioned in Post 3 won't work

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

    Re: Averageifs with OR criteria

    Quote Originally Posted by Subject_Name_Here View Post
    Summation and division of the averages will only work if there are an equal number of terms per product.
    That's right....but the same principle also makes it difficult to use AVERAGEIFS. You can either use SUMIF/COUNTIF as you suggest, e.g.

    =SUMPRODUCT(SUMIF(A$2:A$12,E$2:E$3,B$2:B$12))/SUMPRODUCT(COUNTIF(A$2:A$12,E$2:E$3))

    ...or use this "array formula"

    =AVERAGE(IF(COUNTIF(E$2:E$3,A$2:A$12),B$2:B$12))

    confirmed with CTRL+SHIFT+ENTER
    Audere est facere

+ 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