+ Reply to Thread
Results 1 to 8 of 8

VBA Sum and count 10% of the largest numbers, 10% of the Smallest and 60% of the middle

  1. #1
    Registered User
    Join Date
    04-29-2014
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2003
    Posts
    53

    VBA Sum and count 10% of the largest numbers, 10% of the Smallest and 60% of the middle

    Hello All,

    I would appreciate anyone's help to write a Macro or formulas
    how to Sum and Count 10% of the largest numbers, 10% of the Smallest and 60% of the middle
    in an array of numbers,

    Thank you.

  2. #2
    Forum Guru Kaper's Avatar
    Join Date
    12-14-2013
    Location
    Warsaw, Poland
    MS-Off Ver
    most often: Office 365 in Windows environment
    Posts
    8,623

    Re: VBA Sum and count 10% of the largest numbers, 10% of the Smallest and 60% of the middl

    Let's assume your numbers are in A column
    Count is easy because it is 10%+10%+60% = 80% of all numbers
    Or if used separately just 10% of all etc.
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    sum is a bit tougher.
    for top 10% or bottom 10%
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    for middle 60%:
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    (we drop 40%: 20 at small and 20 at large side)
    if neededed just add all 3.
    Best Regards,

    Kaper

  3. #3
    Registered User
    Join Date
    04-29-2014
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2003
    Posts
    53

    Re: VBA Sum and count 10% of the largest numbers, 10% of the Smallest and 60% of the middl

    Thank you very much, Kaper.
    Formulas are working, only I did not test them for accuracy-)

    I appreciate your help!

  4. #4
    Registered User
    Join Date
    04-29-2014
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2003
    Posts
    53

    Re: VBA Sum and count 10% of the largest numbers, 10% of the Smallest and 60% of the middl

    Hello,

    How could we calculate an average number of those formulas?

    For example, there are 300 rows in 2 columns. So, we selected top 10% and now we need to find out a average number of those top 10%. The same with bottom 10%,
    and with middle 60%.

    =SUMIF(A:A,"<="&SMALL(A:A,COUNT(A:A)*10%))

    =SUMIF(A:A,">="&LARGE(A:A,COUNT(A:A)*10%))
    =SUMIFS(A:A,A:A,">="&SMALL(A:A,COUNT(A:A)*20%),A:A,"<="&LARGE(A:A,COUNT(A:A)*20%))

    Thank you.

  5. #5
    Forum Guru Kaper's Avatar
    Join Date
    12-14-2013
    Location
    Warsaw, Poland
    MS-Off Ver
    most often: Office 365 in Windows environment
    Posts
    8,623

    Re: VBA Sum and count 10% of the largest numbers, 10% of the Smallest and 60% of the middl

    Using respective COUNTIF or countifS (as we have the sum, then divided by count return average).

    It will be more accurate tnen using 10%*COUNTA(A:A) etc.

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

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

    etc.

  6. #6
    Registered User
    Join Date
    04-29-2014
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2003
    Posts
    53

    Re: VBA Sum and count 10% of the largest numbers, 10% of the Smallest and 60% of the middl

    Thank you very much, Kaper- It works!!

  7. #7
    Forum Guru Kaper's Avatar
    Join Date
    12-14-2013
    Location
    Warsaw, Poland
    MS-Off Ver
    most often: Office 365 in Windows environment
    Posts
    8,623

    Re: VBA Sum and count 10% of the largest numbers, 10% of the Smallest and 60% of the middl

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

  8. #8
    Registered User
    Join Date
    04-29-2014
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2003
    Posts
    53

    Re: VBA Sum and count 10% of the largest numbers, 10% of the Smallest and 60% of the middl

    Ok. Thanks again-

+ 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] Ranking numbers in a column from largest to smallest.
    By Securitysports in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 11-04-2013, 04:46 AM
  2. Sorting numbers from smallest to largest
    By gjrr4x1 in forum Excel General
    Replies: 3
    Last Post: 05-10-2013, 12:46 PM
  3. [SOLVED] average without the six largest and smallest numbers
    By Mengo85 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 04-10-2013, 10:41 AM
  4. Replies: 3
    Last Post: 04-30-2012, 09:28 AM
  5. Replies: 3
    Last Post: 01-10-2012, 11:25 AM
  6. 3 largest qty and 3 smallest
    By geng in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 07-09-2010, 12:20 AM
  7. Largest and smallest sequences
    By smileyc in forum Excel General
    Replies: 8
    Last Post: 01-13-2009, 10:46 AM

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