+ Reply to Thread
Results 1 to 6 of 6

conditional average of 2 data columns

Hybrid View

  1. #1
    Registered User
    Join Date
    01-18-2014
    Location
    United States
    MS-Off Ver
    Excel 2010
    Posts
    3

    Question conditional average of 2 data columns

    I am trying to get the conditional average of 2 data columns.

    data_1 category data_2 category
    2.5 Yes 1.2 No
    4.2 No 2.6 No
    3.5 Yes 3.9 Yes
    4.1 No 2.5 Yes

    What I need is the average across the 2 data columns (data_1 and data_2) for category Yes and category No. I know I can use averageif to get the conditional average of 1 column, but that doesn't work with 2.
    Any suggestions will be greatly appreciated.
    Thanks!

  2. #2
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: conditional average of 2 data columns

    Try this...

    Data Range
    A
    B
    C
    D
    E
    F
    G
    1
    data_1
    category
    data_2
    category
    -----
    category
    avg
    2
    2.5
    Yes
    1.2
    No
    yes
    3.1
    3
    4.2
    No
    2.6
    No
    no
    3.025
    4
    3.5
    Yes
    3.9
    Yes
    5
    4.1
    No
    2.5
    Yes


    This formula entered in G2 and copy down:

    =AVERAGEIF(B$2:D$5,F2,A$2:C$5)
    Biff
    Microsoft MVP Excel
    Keep It Simple Stupid

    Let's Go Pens. We Want The Cup.

  3. #3
    Registered User
    Join Date
    01-18-2014
    Location
    United States
    MS-Off Ver
    Excel 2010
    Posts
    3

    Re: conditional average of 2 data columns

    Hey Tony,
    Thanks for the tip. That worked. How would that generalize if my 2 data groups are on 2 different worksheets? for instance, if I have data_1 and category on Sheet1 and then data_2 and category on Sheet2?

  4. #4
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: conditional average of 2 data columns

    Is the data in the exact same location on each sheet?

    What are the real sheet names?

    Are there only 2 sheets or are there several sheets?

  5. #5
    Registered User
    Join Date
    01-18-2014
    Location
    United States
    MS-Off Ver
    Excel 2010
    Posts
    3

    Re: conditional average of 2 data columns

    in most of the cases the data is in the same location on both sheets. There are about 15 data columns on each sheet and 3 categorization columns (data1 data2 ..... data15 category1 category2 category3). names of the sheets are survey1 and survey2 . there are multiple sheets in the workbook but only 2 data worksheets

  6. #6
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: conditional average of 2 data columns

    If there are only 2 sheets then the easiest way would be like this...

    With the data located in the same range on each sheet, A2:B5...

    On some other sheet:

    A1 = Yes
    A2 = No

    Enter this formula in B1 and copy down to B2:

    =(SUMIF(Survey1!B$2:B$5,A1,Survey1!A$2:A$5)+SUMIF(Survey2!B$2:B$5,A1,Survey2!A$2:A$5))/(COUNTIF(Survey1!B$2:B$5,A1)+COUNTIF(Survey2!B$2:B$5,A1))

+ 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. Need Conditional Formula to Average the Data Depending on 2 Conditions
    By Snakehips in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 10-23-2013, 04:37 PM
  2. Average Value where data can be in different columns
    By MHewitt in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 10-01-2013, 03:31 PM
  3. Split data into average across columns
    By Zimbo760 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 03-07-2011, 01:02 AM
  4. Average only columns with data
    By maxthebear in forum Excel General
    Replies: 2
    Last Post: 11-10-2009, 03:10 PM
  5. Average based on data in two columns
    By swright11 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 12-30-2008, 08:08 PM

Tags for this Thread

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