+ Reply to Thread
Results 1 to 8 of 8

Sheets - How to average the top 25% of values based on criteria

  1. #1
    Registered User
    Join Date
    07-20-2019
    Location
    London
    MS-Off Ver
    15
    Posts
    4

    Sheets - How to average the top 25% of values based on criteria

    Hi guys,

    I've been stuck on this issue for hours!

    Basically, I've worked out how to average the top 5 values with the following:

    =iferror(ArrayFormula(AVERAGE(large(if(Data!A:A=A2,Data!H:H),{1,2,3,4,5}))),0)

    What I need to do is is average the top 25% of values in Data!H:H if the cells in Data!A:A match whats in A:A. For the life of me I can not figure it out.

    Any help greatly appreciated!

  2. #2
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    79,323

    Re: Sheets - How to average the top 25% of values based on criteria

    Welcome to the forum.

    Add a helper column, maybe?
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    Forum Rules (updated August 2023): please read them here.

  3. #3
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    43,890

    Re: Sheets - How to average the top 25% of values based on criteria

    In Excel, if I understand you correctly, is:

    =AVERAGE(LARGE(IF($A$4:$A$15=$B$4:$B$15,C4:C15),{1,2,3,4,5}))
    Attached Files Attached Files
    Glenn




    None of us get paid for helping you... we do this for fun. So DON'T FORGET to say "Thank You" to all who have freely given some of their time to help YOU.

    Temporary addition of accented to illustrate ongoing problem to the TT: L? fh?ile P?draig sona dhaoibh

  4. #4
    Registered User
    Join Date
    07-20-2019
    Location
    London
    MS-Off Ver
    15
    Posts
    4
    Quote Originally Posted by AliGW View Post
    Welcome to the forum.

    Add a helper column, maybe?
    Thanks!

    What would be the best way to do that?

  5. #5
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    79,323

    Re: Sheets - How to average the top 25% of values based on criteria

    You'd add a column that flags values that are in the top 25% of values, then use that as the identifier for the AVERAGE formula.

    Hard to advise any more specifically without seeing a workbook sample.

  6. #6
    Registered User
    Join Date
    07-20-2019
    Location
    London
    MS-Off Ver
    15
    Posts
    4
    Quote Originally Posted by Glenn Kennedy View Post
    In Excel, if I understand you correctly, is:

    =AVERAGE(LARGE(IF($A$4:$A$15=$B$4:$B$15,C4:C15),{1,2,3,4,5}))
    Wouldn't that just return the average of the top 5 values? I have already managed to work that out, what i would like to do instead is grab the average of the top 25% of values based on a criteria. Its driving me insane!

  7. #7
    Registered User
    Join Date
    07-20-2019
    Location
    London
    MS-Off Ver
    15
    Posts
    4
    Quote Originally Posted by AliGW View Post
    You'd add a column that flags values that are in the top 25% of values, then use that as the identifier for the AVERAGE formula.

    Hard to advise any more specifically without seeing a workbook sample.

    Ooh interesting. I'll give this a go. Thanks!

  8. #8
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    43,890

    Re: Sheets - How to average the top 25% of values based on criteria

    No. If you look at the sheet, it is returning the average of the values in yellow... NOT the top 5 values. The criterion (which I may have picked up incorrectly) was that the value in (for example) A4 must be equal to the value in B4 before the value in C4 becmes eligible for selection as one of the top 5.

    Did you actually open the sheet??

    If that is NOT the criterion, attach a sample sheet with some made-up values and an expected answer.


    Unfortunately the attachment icon doesn't work at the moment. So, to attach an Excel file you have to do the following: Just before posting, scroll down to Go Advanced and then scroll down to Manage Attachments. Now follow the instructions at the top of that screen.

+ 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] Average amount of latest 4 values based on criteria
    By goodguyrulz in forum Excel Formulas & Functions
    Replies: 15
    Last Post: 11-12-2018, 09:08 AM
  2. Replies: 2
    Last Post: 07-30-2018, 02:21 PM
  3. VBA: Sum values based on matching criteria across two sheets
    By Stretch444 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-06-2017, 06:43 PM
  4. [SOLVED] Lookup Values based on criteria from two sheets
    By mlbdc2012 in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 02-12-2015, 07:56 PM
  5. Average of values across 5 sheets with two criteria.
    By imranrasool in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 06-12-2014, 08:34 AM
  6. Average over more sheets with criteria
    By Reinder in forum Excel Formulas & Functions
    Replies: 11
    Last Post: 11-06-2009, 04:10 AM
  7. copy/pasting of values between sheets based on criteria
    By sunilmulay in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 05-26-2009, 10:49 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