+ Reply to Thread
Results 1 to 7 of 7

Average column based on another columns value.

  1. #1
    Registered User
    Join Date
    07-29-2014
    Location
    Baton Rouge, Louisiana
    MS-Off Ver
    2010 Mac osx
    Posts
    8

    Question Average column based on another columns value.

    Hey there guys.

    I was hoping someone could help me with this. I would like to average a column based upon another column value. Namely, if one column is a duplicate, I would like to take the column to its right value and average all the duplicates. For example

    comp 1409 99.7
    comp 1409 99.5
    comp 1409 100
    comp 1308 65.7
    comp 1509 99.5

    I would like that to become

    comp 1409 99.73
    comp 1308 65.7
    comp 1509 99.5


    Any help is appreciated. Thanks much!

  2. #2
    Forum Expert daffodil11's Avatar
    Join Date
    07-11-2013
    Location
    Phoenixville, PA
    MS-Off Ver
    MS Office 2016
    Posts
    4,465

    Re: Average column based on another columns value.

    Let's pretend your data starts in A1, and you got the things you care about in C1.

    D1

    =AVERAGEIFS($C$1:$C$5,$B$2:$B$5,B2) and copy down the side
    Make Mom proud: Add to my reputation if I helped out!

    Make the Moderators happy: Mark the Thread as Solved if your question was answered!

  3. #3
    Registered User
    Join Date
    07-29-2014
    Location
    Baton Rouge, Louisiana
    MS-Off Ver
    2010 Mac osx
    Posts
    8

    Re: Average column based on another columns value.

    Hey so in the interest of learning, what exactly in that formula denotes that it is to be average if a duplicate is present?

    Also, there are about 800,000 values. Does the scale influence how this should be done?


    EDIT: Did as you asked and it only seems to find a new average. I would like it to a) collapse all the duplicates and then instead present the average in a particular column.

    a 1
    a 1
    a 1
    a 1
    a 1
    b 1
    c 1
    d 1
    e 1
    e 1
    e 1

    becomes

    a 1
    b 1
    c 1
    d 1
    e 1
    Last edited by Dusang; 07-29-2014 at 04:12 PM.

  4. #4
    Forum Expert daffodil11's Avatar
    Join Date
    07-11-2013
    Location
    Phoenixville, PA
    MS-Off Ver
    MS Office 2016
    Posts
    4,465

    Re: Average column based on another columns value.

    Okay, let's pretend A1:A800000 is your range.

    Copy that column, paste over in D. Select your new range D1:D800000, go to Data -> Remove Duplicates, and hit okay.

    Now you have your unique values to build off of. From here, there's a number of ways you can proceed.


    =AVERAGEIF(criteria range, criteria, average range)


    So, for E1:
    =AVERAGEIF($A$1:$A$800000,D1,$B$1:$B$800000) and copy down

    This will average column B where Column A equals whats in D1.


    Another example would be to use SUMPRODUCT, though a bit longer.

    E1:
    =SUMPRODUCT(($A$1:$A$800000=D1)*($B$1:$B$800000))/SUMPRODUCT(--($A$1:$A$800000=D1))

    This is the SUM of Column B where Column A equals D1, divided by the number of times Column A equaled D.

  5. #5
    Registered User
    Join Date
    07-29-2014
    Location
    Baton Rouge, Louisiana
    MS-Off Ver
    2010 Mac osx
    Posts
    8

    Re: Average column based on another columns value.

    It worked and I learned a bit too. Thanks a lot!

  6. #6
    Forum Expert daffodil11's Avatar
    Join Date
    07-11-2013
    Location
    Phoenixville, PA
    MS-Off Ver
    MS Office 2016
    Posts
    4,465

    Re: Average column based on another columns value.

    No problem, glad I could help.




    If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED. Thanks.

  7. #7
    Forum Expert
    Join Date
    12-11-2011
    Location
    Netherlands
    MS-Off Ver
    office 365
    Posts
    3,293

    Re: Average column based on another columns value.

    Or try the use of a pivot table
    Willem
    English is not my native language sorry for errors
    Please correct me if I'm completely wrong

+ 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. Replies: 4
    Last Post: 12-12-2012, 11:26 AM
  2. [SOLVED] Find average of column b based on boundaries applied to column a
    By Kybynn in forum Excel General
    Replies: 1
    Last Post: 12-04-2012, 07:17 AM
  3. Replies: 2
    Last Post: 06-25-2012, 11:21 PM
  4. Replies: 8
    Last Post: 02-16-2011, 05:03 PM
  5. Replies: 0
    Last Post: 09-01-2010, 02:47 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