+ Reply to Thread
Results 1 to 11 of 11

Top 2 total values in a range

  1. #1
    Registered User
    Join Date
    03-16-2007
    Posts
    7

    Top 2 total values in a range

    Hi all.

    I'm looking to automatically extract the top 2 total values from a range. For example:

    Customer1 20000
    customer2 10303

    I'm familiar with the Large formula, but I somehow need to sum all the products.

    I attached an example. if anyone can help it would be greatly appreciated.

    using Excel 2010 on a windows 7 machine.
    Thanks
    Attached Files Attached Files

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

    Re: Top 2 total values in a range

    with an helpcolum to total the values per row.

    then i made a pivot table of the data.

    after that i sort the pivot table from big to small.

    see the attached file.

    notice I get 1) customer 4 and 2) customer 2 as result.
    Attached Files Attached Files
    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.

  3. #3
    Valued Forum Contributor
    Join Date
    07-27-2012
    Location
    Dublin, Ireland
    MS-Off Ver
    Excel 2010
    Posts
    826

    Re: Top 2 total values in a range

    elqueso, welcome to the forum.

    The top two values in the range (Jan - Dec) in your example are 5465361, and 6546. Do you mean you want the top two values by sum of whatever those numbers are, on a per customer basis? Or a per product basis? Am I correct in assuming it's over the whole year, or do you want it by month?
    Brendan.


    __________________________________________________________________________________________________
    Things to consider:

    1) You can thank any poster by clicking the * at the left of a helpful post.
    2) You can help to keep the forum tidy by marking your thread as "Solved", if it has been answered to your satisfaction.
    3) Help us to help you, by uploading a sample workbook, showing the type of data you're dealing with, and clearly indicating what the results should be.

  4. #4
    Forum Expert Ace_XL's Avatar
    Join Date
    06-04-2012
    Location
    UAE
    MS-Off Ver
    2016
    Posts
    6,074

    Re: Top 2 total values in a range

    In B3 how about..

    =SUMPRODUCT(LARGE(($A$11:$A$58=A3)*($C$11:$N$58),{1,2}))

    copy down
    Life's a spreadsheet, Excel!
    Say thanks, Click *

  5. #5
    Registered User
    Join Date
    03-16-2007
    Posts
    7

    Re: Top 2 total values in a range

    Hi all,

    thanks for the replies.

    so I am looking for a Yearly total for the top 2 customers.. regardless of how many products they purchased.

    unfortunately the SUMPRODUCT will not work as the values and ranges will always be different. Also I was hoping for combining a formula somehow.

    thanks again guys.

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

    Re: Top 2 total values in a range

    Please Login or Register  to view this content.
    then you have to expand the range in the sumproductformula.

  7. #7
    Forum Guru
    Join Date
    05-24-2011
    Location
    India
    MS-Off Ver
    Office 2021
    Posts
    2,237

    Re: Top 2 total values in a range

    Use a column for yearly total Jan:Dec.

    Eg: in O11 use =SUM(C11:N11) to get row total & copy down. Then,

    in A3 with CTRL+SHIFT+ENTER

    =INDEX(A$11:A$58,MATCH(B3,SUMIF(A$11:A$58,A$11:A$158,O$11:O$58),0))

    B3, with CTRL+SHIFT+ENTER

    =LARGE(IF(ISNA(MATCH(A$11:A$58,A$2:A2,0)),SUMIF(A$11:A$58,A$11:A$58,O$11:O$58),""),1)

    Then select A3:B3 & copy down.
    Regards,
    Haseeb Avarakkan

    __________________________________
    "Feedback is the breakfast of champions"

  8. #8
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: Top 2 total values in a range

    i'm with oeldere but that sheet appears to be blank i did it like this
    Attached Files Attached Files
    "Unless otherwise stated all my comments are directed at OP"

    Mojito connoisseur and now happily retired
    where does code go ?
    look here
    how to insert code

    how to enter array formula

    why use -- in sumproduct
    recommended reading
    wiki Mojito

    how to say no convincingly

    most important thing you need
    Martin Wilson: SPV
    and RSMBC

  9. #9
    Forum Expert newdoverman's Avatar
    Join Date
    02-07-2013
    Location
    Port Dover, Ontario, Canada
    MS-Off Ver
    2010
    Posts
    10,330

    Re: Top 2 total values in a range

    I like the Pivot Table solution of martindwilson because you don't even need to do any calculations on the data sheet. To get the totals for each customer just add a calculated field to the report then click in the Customer field of the Pivot Table, Filter, Top 10, choose any value from 1 to 10 and filter on the calculated field. It is easy and you can change your criteria with a couple of key strokes.

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


    This Pivot table makes use of a Calculated field with the above formula as the calculation.
    Attached Files Attached Files
    Last edited by newdoverman; 07-18-2013 at 09:32 AM.
    <---------If you like someone's answer, click the star to the left of one of their posts to give them a reputation point for that answer.
    Ron W

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

    Re: Top 2 total values in a range

    @martindwilson

    Thanks for pointing me on the fact the added example is empty.

    Here you find the excel file wiht the pivot table.
    Attached Files Attached Files

  11. #11
    Registered User
    Join Date
    03-16-2007
    Posts
    7

    Re: Top 2 total values in a range

    thanks for the support guys.

    very much appreciated.

+ 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] Count total of odd values in range with dash as a separator
    By sans in forum Excel Programming / VBA / Macros
    Replies: 21
    Last Post: 04-21-2013, 05:56 PM
  2. [SOLVED] Countif with one range to values added to give one total....
    By Mctiny in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 08-15-2012, 08:26 PM
  3. Replies: 11
    Last Post: 07-15-2012, 04:08 PM
  4. Replies: 8
    Last Post: 01-27-2010, 04:40 AM
  5. Total values from date range table
    By MrFoxar in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 08-10-2009, 04: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