+ Reply to Thread
Results 1 to 9 of 9

return average counts for distinct samples but with same name

  1. #1
    Registered User
    Join Date
    10-29-2012
    Location
    MA,US
    MS-Off Ver
    Excel 2011
    Posts
    9

    return average counts for distinct samples but with same name

    I need a formula that would allow me to return the average count value (column E) for unique samples (column D) from total counts (column A) from a list of samples (column B). Some samples have the same name (e.g. A), but is considered unique because they are located between rows of unique samples (e.g. 1a and 2a). I can get the average by calculating samples A, 1a, A, and 2a one at a time, but is tedious and would like a formula that can do an entire column all at once to return the average number for "unique" samples (like in column E). i've attached a spreadsheet to show you what I mean.

    Thanks for any advice.
    Last edited by FDibbins; 11-18-2012 at 09:18 PM. Reason: i forgot to attach spreadsheet

  2. #2
    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
    53,050

    Re: return average counts for distinct samples but with same name

    Have you tried playing around with teh averageifS() function?

    If this doesnt work for you, i would suggest you upload a sample work book, (all sensitive data removed), showing what data you are working with, what your expected outcome is, and how you arrived at that

    To Attach a File:

    1. Click on Go Advanced
    2. In the frame Attach Files you will see the button Manage Attachments
    3. Click the button.
    4. A new window will open titled Manage Attachments - Excel Forum.
    5. Click the Browse... button to locate your file for uploading.
    6. This will open a new window File Upload.
    7. Once you have located the file to upload click the Open button. This window will close.
    8. You are now back in the Manage Attachments - Excel Forum window.
    9. Click the Upload button and wait until the file has uploaded.
    10. Close the window and then click Submit.
    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

  3. #3
    Registered User
    Join Date
    10-29-2012
    Location
    MA,US
    MS-Off Ver
    Excel 2011
    Posts
    9

    Re: return average counts for distinct samples but with same name

    no, I haven't tried any other functions because I don't know enough of the proper syntax to write complicated formulas.
    I think I've attached the spreadsheet. let me know if it didn't work.
    Attached Files Attached Files

  4. #4
    Forum Contributor Steve N.'s Avatar
    Join Date
    12-22-2011
    Location
    USA
    MS-Off Ver
    Excel 2007, 2010
    Posts
    298

    Re: return average counts for distinct samples but with same name

    How about this pivot table as a possible solution? See attached...
    Attached Files Attached Files

  5. #5
    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
    53,050

    Re: return average counts for distinct samples but with same name

    Based on the sample you provided, this worked...

    =AVERAGEIF($B$2:$B$18,D2,$A$2:$A$18)

  6. #6
    Registered User
    Join Date
    10-29-2012
    Location
    MA,US
    MS-Off Ver
    Excel 2011
    Posts
    9

    Re: return average counts for distinct samples but with same name

    Both suggestions above returns the average for the A sample to be 2.5, but what I was looking for is a solution to average the A samples in rows 2 to 6 separately to equal 2 and rows 11 to 15 separately to equal 3. I need to keep the counts for "A" samples distinct so they can be averaged separately when they are spaced between unique samples like 1a and 2a.

  7. #7
    Forum Contributor Steve N.'s Avatar
    Join Date
    12-22-2011
    Location
    USA
    MS-Off Ver
    Excel 2007, 2010
    Posts
    298

    Re: return average counts for distinct samples but with same name

    Not sure where to begin with a formula that could perform the function.

    However, I can suggest that you consider revising the sample label from just A to something like A-1 and A-2 for each set.

    Or, you could add a 3rd (or, 'helper') column to provide a unique identifier for each sample set. Perhaps a column with a Batch number or date.

    I've included a pivot table example for each option described.

    Hope this is getting you closer to a workable solution...

    Steve
    Attached Files Attached Files

  8. #8
    Registered User
    Join Date
    10-29-2012
    Location
    MA,US
    MS-Off Ver
    Excel 2011
    Posts
    9

    Re: return average counts for distinct samples but with same name

    Steve, thanks for working on this. I kind of knew I would eventually have to give the A samples in rows 2-6 and 11-15 unique names or else the formula would average the counts from all of the A samples combined. Anyway thanks for spending time on this problem...

  9. #9
    Forum Contributor Steve N.'s Avatar
    Join Date
    12-22-2011
    Location
    USA
    MS-Off Ver
    Excel 2007, 2010
    Posts
    298

    Re: return average counts for distinct samples but with same name

    My pleasure.

  10. #10
    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
    53,050

    Re: return average counts for distinct samples but with same name

    Based on your last post it seems that you are satisfied with the solution(s) you've received but you haven't marked your thread as SOLVED. I'll do that for you now but please keep in mind for your future threads that Rule #9 requires you to do that yourself. If your problem has not been solved you can use Thread Tools (located above your first post) and choose "Mark this thread as unsolved".
    Thanks.

    Also, as a relatively new member of the forum, you may not be aware that you can thank those who have helped you by clicking the small star icon located in the lower left corner of the post in which the help was given. By doing so you can add to the reputation(s) of those who helped.

+ 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