+ Reply to Thread
Results 1 to 13 of 13

Count of Top 50 % of Values

  1. #1
    Registered User
    Join Date
    03-14-2014
    Location
    SoCal
    MS-Off Ver
    Excel 2007
    Posts
    7

    Count of Top 50 % of Values

    Hey guys,

    I'm having an issue that I need some help on. Basically trying to replicate what a Pivot Table Top 10 Percent of Column does in a formula. My goal is to count the number of values that add up to be the Top 50 percent of Sales.

    Please see the attachment for an example.

    I thought of using the Large function but the list size will vary and is in the thousands.

    This is the formula I thought would work but I must be misunderstanding the Percentile function.

    Formula: copy to clipboard
    Please Login or Register  to view this content.
    (used as an Array Formula)

    Any help will be much appreciated!!
    Attached Files Attached Files

  2. #2
    Forum Guru samba_ravi's Avatar
    Join Date
    07-26-2011
    Location
    Hyderabad, India
    MS-Off Ver
    Excel 2021
    Posts
    8,914

    Re: Count of Top 50 % of Values

    Try below array formula (Shift + Ctrl + Enter)
    Please Login or Register  to view this content.
    Samba

    Say thanks to those who have helped you by clicking Add Reputation star.

  3. #3
    Forum Guru samba_ravi's Avatar
    Join Date
    07-26-2011
    Location
    Hyderabad, India
    MS-Off Ver
    Excel 2021
    Posts
    8,914

    Re: Count of Top 50 % of Values

    if you are open for helper column it will be done with sample large and match functions

  4. #4
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: Count of Top 50 % of Values

    Hi,

    Just a thought but the following array formula will return an ordered list of values

    Formula: copy to clipboard
    Please Login or Register  to view this content.


    I'm still struggling to find a SIMPLE function that will convert this to a cumulative ordered list. I'm sure there is something and once that's in place then a simple LOOKUP for the 50% of sales total will return the relevant position in the list.
    Richard Buttrey

    RIP - d. 06/10/2022

    If any of the responses have helped then please consider rating them by clicking the small star icon below the post.

  5. #5
    Forum Expert
    Join Date
    06-08-2012
    Location
    Left the forum!
    MS-Off Ver
    Left the forum!
    Posts
    5,189

    Re: Count of Top 50 % of Values

    Quote Originally Posted by nflsales View Post
    Try below array formula (Shift + Ctrl + Enter)
    Please Login or Register  to view this content.
    Not going to pretend that I fully understand that formula, but in the process of trying to follow it, I tried a different approach to the logic, which appears to work with a shorter formula.

    Formula: copy to clipboard
    Please Login or Register  to view this content.

  6. #6
    Registered User
    Join Date
    03-14-2014
    Location
    SoCal
    MS-Off Ver
    Excel 2007
    Posts
    7

    Re: Count of Top 50 % of Values

    Thank you guys for your help thus far but I'm still having issues. Both 'nflsales' & 'jason.b75's formulas work on the sample data set I provided but it is not working on a large data set. Please see attached.

    I'm not sure if it is because of the sheer size of the data that is causing problem for the MMULT function?
    Attached Files Attached Files

  7. #7
    Forum Expert
    Join Date
    06-08-2012
    Location
    Left the forum!
    MS-Off Ver
    Left the forum!
    Posts
    5,189

    Re: Count of Top 50 % of Values

    Quote Originally Posted by MrIceBreaker View Post
    I'm not sure if it is because of the sheer size of the data that is causing problem for the MMULT function?
    I think that it would be a safe assumption.

    Silly question, any reason why you don't just do a simple count of the pivot table records?

    If that is not possible for any reason, then you're stuck with a helper column to try and reduce resource drain.

  8. #8
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: Count of Top 50 % of Values

    Stating the obvious I suppose but why not make use of your Pivot Table and just use.
    Formula: copy to clipboard
    Please Login or Register  to view this content.


    Hide the PT if necessary on another sheet and make it refresh dynamically when some appropriate event occurs (perhaps a sheet change event in column A or B) with an Application.RefreshAll instruction.

    Or are you trying to do away with the PT altogether?

  9. #9
    Registered User
    Join Date
    03-14-2014
    Location
    SoCal
    MS-Off Ver
    Excel 2007
    Posts
    7

    Re: Count of Top 50 % of Values

    I'm trying to do away with the Pivot Table. I have multiple qualifiers that I need to apply on the data set.

    What I'm trying to do in essence is find out what number (count) of the items represent: Top 50% of Sales, 30%, 10%, 5%, Bottom 5% of Sales.

    I will then be drilling the data by Department, Sub-Dept, Class, etc.

    It becomes extremely tedious to have to update the filters on the Pivot Tables for each Sub-Dept, Class, etc.

    Can you elaborate on the 'helper column'? If it's an addition of a column to help assist in solving the problem then I'm open to it but not sure how to go about it.

  10. #10
    Forum Expert
    Join Date
    06-08-2012
    Location
    Left the forum!
    MS-Off Ver
    Left the forum!
    Posts
    5,189

    Re: Count of Top 50 % of Values

    Quote Originally Posted by MrIceBreaker View Post
    It becomes extremely tedious to have to update the filters on the Pivot Tables for each Sub-Dept, Class, etc.
    It may be the lesser evil.

    I tried what should be a fairly simple helper formula in column C, but given the number of records in the data set, it is taking a considerable time to fill down, and that's just to process top x% of sales, adding extra criteria to drill on department, etc. will only increase the workload!

  11. #11
    Forum Expert
    Join Date
    05-30-2012
    Location
    The Netherlands
    MS-Off Ver
    Office 365
    Posts
    14,987

    Re: Count of Top 50 % of Values

    maybe you can delete the 0 values (which are 52.304 rows).
    Notice my main language is not English.

    I appreciate it, if you reply on my solution.

    If you are satisfied with the solution, please mark the question solved.

    You can add reputation by clicking on the star * add reputation.

  12. #12
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: Count of Top 50 % of Values

    Here's an approach that uses a helper column, two in fact.

    Column C lists the column B values in ascending order
    Column D contains the cumulative values in column C with an If test which results in a 1 if the running total is less than the 50% value in C1. Then all that's required is to sum column D and add 1 since the 655th value is the one that exceeds the target value.

    Note that I have only copied the helper formulae down to row 2000. Statistically speaking if there's a wide range of numbers then there's no point in carrying the formulae down all 59000 rows since that is very resource heavy in calculation terms.
    Attached Files Attached Files

  13. #13
    Forum Expert dflak's Avatar
    Join Date
    11-24-2015
    Location
    North Carolina
    MS-Off Ver
    365
    Posts
    7,920

    Re: Count of Top 50 % of Values

    Would a pivot table do?
    Attached Files Attached Files
    Last edited by dflak; 05-02-2016 at 05:20 PM. Reason: Oops - looks like it's already solved.
    One spreadsheet to rule them all. One spreadsheet to find them. One spreadsheet to bring them all and at corporate, bind them.

    A picture is worth a thousand words, but a sample spreadsheet is more likely to be worked on.

+ 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: 2
    Last Post: 01-21-2014, 02:53 PM
  2. Count Intervals of Filtered TEXT values in Column and Return Count across a Row
    By Sam via OfficeKB.com in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-06-2005, 12:05 PM
  3. [SOLVED] Count Intervals of Filtered TEXT values in Column and Return Count across a Row
    By Sam via OfficeKB.com in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-06-2005, 10:05 AM
  4. Replies: 27
    Last Post: 09-06-2005, 04:05 AM
  5. [SOLVED] Count Intervals of Filtered TEXT values in Column and Return Count across a Row
    By Sam via OfficeKB.com in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-06-2005, 03:05 AM
  6. Count Intervals of Filtered TEXT values in Column and Return Count across a Row
    By Sam via OfficeKB.com in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-06-2005, 02:05 AM
  7. [SOLVED] Count Intervals of Filtered TEXT values in Column and Return Count across a Row
    By Sam via OfficeKB.com in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-05-2005, 10:05 PM
  8. Count Intervals of Filtered TEXT values in Column and Return Count across a Row
    By Sam via OfficeKB.com in forum Excel Formulas & Functions
    Replies: 9
    Last Post: 07-30-2005, 11:05 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