+ Reply to Thread
Results 1 to 3 of 3

How to use AVERAGEIF to include multiple rows of data

  1. #1
    Registered User
    Join Date
    04-25-2011
    Location
    Atlanta, GA
    MS-Off Ver
    Excel 2007
    Posts
    13

    How to use AVERAGEIF to include multiple rows of data

    Hi everyone,

    I have a block of data for which I would like to calculate an average. However, I only want rows of data to be used that meet a criteria. Please see the attached sample. I also copied it below for easy viewing. I want to calculate the average of the values in v1, v2, and v3, but only for those rows where Crit = c.

    I want to do this for calculating averages, but would also like to know how to do this for other calculations. Not just averages. Thanks.

    AvgSample.xlsx

    C v1 v2 v3
    a 4 4 7
    b 6 1 1
    b 2 6 5
    a 5 7 6
    c 1 1 2
    b 7 1 4
    a 5 5 3
    b 2 6 6
    c 6 7 1

  2. #2
    Forum Expert Ace_XL's Avatar
    Join Date
    06-04-2012
    Location
    UAE
    MS-Off Ver
    2016
    Posts
    6,074

    Re: How to use AVERAGEIF to include multiple rows of data

    Use SUMPRODUCT

    =SUMPRODUCT(($A$2:$A$10="c")*$B$2:$D$10)/SUMPRODUCT(--($A$2:$A$10="c"))

    The numerator gives sum of all values corresponding to 'c'

    The denominator gives number of 'c' appearing in Column A i.e. 2

    or maybe..
    =SUMPRODUCT(($A$2:$A$10="c")*$B$2:$D$10)/SUMPRODUCT(($A$2:$A$10="c")*ISNUMBER(B2:D10))

    The denominator will give value 6 corresponding to 3 columns each where c is found in column A
    Life's a spreadsheet, Excel!
    Say thanks, Click *

  3. #3
    Registered User
    Join Date
    04-25-2011
    Location
    Atlanta, GA
    MS-Off Ver
    Excel 2007
    Posts
    13

    Re: How to use AVERAGEIF to include multiple rows of data

    Awesome!

    The second one you suggested did it.

    In the first one, the denominator returned a value of 2, I guess counting the number of times "c" showed up.

    And the denominator in the second formula counts the number of times there is a value where Crit = c.

    Now to go learn how all the functions you use work! Lol! Thank you very much for your help. I'll mark this post solved.

+ 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. [SOLVED] In a pivot table, can the avg of a column include rows w/o data?
    By Aaron in forum Excel General
    Replies: 3
    Last Post: 04-04-2016, 03:14 PM
  2. Replies: 3
    Last Post: 05-07-2015, 01:26 PM
  3. Replies: 4
    Last Post: 04-13-2015, 04:41 PM
  4. Please edit my macro to include all rows having data
    By nadeem77 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 12-08-2014, 11:49 AM
  5. [SOLVED] Editing a Macro to include multiple rows and include text formatting for leading zeros
    By missmea2005 in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 04-04-2014, 09:50 AM
  6. Replies: 5
    Last Post: 03-01-2012, 05:08 AM
  7. chart to include new rows pasted to data set
    By jrtaylor in forum Excel Charting & Pivots
    Replies: 4
    Last Post: 12-05-2008, 09:55 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