+ Reply to Thread
Results 1 to 14 of 14

Find sum with multiple conditions of 'top n values of a table'.

  1. #1
    Forum Contributor
    Join Date
    05-18-2011
    Location
    Delhi , India
    MS-Off Ver
    Excel 2007
    Posts
    171

    Find sum with multiple conditions of 'top n values of a table'.

    Please check the attachment.
    Attached Files Attached Files

  2. #2
    Forum Contributor
    Join Date
    05-18-2011
    Location
    Delhi , India
    MS-Off Ver
    Excel 2007
    Posts
    171

    Re: Find sum with multiple conditions of 'top n values of a table'.

    Untitled.jpg This is the image.

  3. #3
    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
    52,945

    Re: Find sum with multiple conditions of 'top n values of a table'.

    Sorry for off-topic interjection:

    Although there is no official rule regarding this behavior, we request that wherever possible both the question AND the answer be provided in substantive detail here within the thread. An attached workbook is an excellent aid for posing a question and offering a solution, but solely doing that with no in thread explanation makes it difficult for researchers to understand or consider the Q & A of this thread without downloading what may be a pointless doc to them, if they can do that at all. Doing that also hides the content from search engines so others may never benefit from this.

    I'm sure you understand, and we look forward to seeing you post your formulas/macros in your posts for the searching benefit of all.

    Thanks again for all your hard work here!
    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

  4. #4
    Forum Contributor
    Join Date
    05-18-2011
    Location
    Delhi , India
    MS-Off Ver
    Excel 2007
    Posts
    171

    Re: Find sum with multiple conditions of 'top n values of a table'.

    @FDibbins got it.

    I want to find the FORMULA for the sum of first 5 values of column D (Header "%") with following conditions :

    1) Find top 20 values according to column B (Header "Weight")

    2) Find the top 10 values of column C (Header "Vol") from the 20 values of point 1.

    3) Find the sum of first 5 Values from column D.

    Basically i want to sort the whole table (high to low), first by column B , then from top 20 values sort column C and finally find the sum of first 5 values of column D.

    I am using the formula below but the problem is that the values keep changing in column B & C. So i need to find a formula in which it can find the top values in those columns.

    Please Login or Register  to view this content.
    Attached Files Attached Files
    Last edited by Sarangsood; 03-14-2016 at 03:12 AM.

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

    Re: Find sum with multiple conditions of 'top n values of a table'.

    Sum of 20 Value from Column B
    Please Login or Register  to view this content.
    Sum of 10 Value from Column C
    Please Login or Register  to view this content.
    Sum of 5 Value from Column D
    Please Login or Register  to view this content.
    Samba

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

  6. #6
    Forum Expert bebo021999's Avatar
    Join Date
    07-22-2011
    Location
    Vietnam
    MS-Off Ver
    Excel 2016
    Posts
    9,481

    Re: Find sum with multiple conditions of 'top n values of a table'.

    Try:

    Please Login or Register  to view this content.
    ...confirmed by pressing CTRL+SHIFT+ENTER to activate the array, not just ENTER. You will know the array is active when you see curly braces { } appear around your formula. If you do not CTRL+SHIFT+ENTER you will get an error or a clearly incorrect answer.
    Quang PT

  7. #7
    Forum Contributor
    Join Date
    05-18-2011
    Location
    Delhi , India
    MS-Off Ver
    Excel 2007
    Posts
    171

    Re: Find sum with multiple conditions of 'top n values of a table'.

    The sum should be 41%.

    If you check it by sorting it manually. You will first sort the whole table by column B (High to Low), then again sort column C but only till row 21 and finally sum of first 5 values of column D.
    Last edited by Sarangsood; 03-14-2016 at 03:52 AM.

  8. #8
    Forum Contributor
    Join Date
    05-18-2011
    Location
    Delhi , India
    MS-Off Ver
    Excel 2007
    Posts
    171

    Re: Find sum with multiple conditions of 'top n values of a table'.

    Quote Originally Posted by nflsales View Post
    Sum of 20 Value from Column B
    Please Login or Register  to view this content.
    Sum of 10 Value from Column C
    Please Login or Register  to view this content.
    Sum of 5 Value from Column D
    Please Login or Register  to view this content.
    i saw the individual formula. till column c its coming out just fine.

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

    Re: Find sum with multiple conditions of 'top n values of a table'.

    FOR Sum of 5 Value from Column D
    =sumproduct(large((b2:b30>=large(b2:b30,20))*(c2:c30>=large(c2:c30,10))*(d2:d30),row(indirect("1:10")))) change this one as
    =sumproduct(large((b2:b30>=large(b2:b30,20))*(c2:c30>=large(c2:c30,10))*(d2:d30),row(indirect("1:5"))))

  10. #10
    Forum Contributor
    Join Date
    05-18-2011
    Location
    Delhi , India
    MS-Off Ver
    Excel 2007
    Posts
    171

    Re: Find sum with multiple conditions of 'top n values of a table'.

    Quote Originally Posted by nflsales View Post
    FOR Sum of 5 Value from Column D
    =sumproduct(large((b2:b30>=large(b2:b30,20))*(c2:c30>=large(c2:c30,10))*(d2:d30),row(indirect("1:10")))) change this one as
    =sumproduct(large((b2:b30>=large(b2:b30,20))*(c2:c30>=large(c2:c30,10))*(d2:d30),row(indirect("1:5"))))
    yes i did that but the answer is still not coming.

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

    Re: Find sum with multiple conditions of 'top n values of a table'.

    How it was 41%,

    it was 18.46% + 15.26% + 8.37% + 6.16% + 5.27% = 53.52%

  12. #12
    Forum Contributor
    Join Date
    05-18-2011
    Location
    Delhi , India
    MS-Off Ver
    Excel 2007
    Posts
    171

    Re: Find sum with multiple conditions of 'top n values of a table'.

    sir i 1st sorted the whole table from column B (largest to smallest). then i sorted the 1st 20 rows from column C.

    then the 1st 5 values in column D comes out to be : 2.46% + 6.16% + 18.46% + 5.27% + 8.83% = 41.18%.

    I have uploaded the file by how the desired result of 41.18% was achieved.

    Thanks
    Attached Files Attached Files
    Last edited by Sarangsood; 03-14-2016 at 06:31 AM.

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

    Re: Find sum with multiple conditions of 'top n values of a table'.

    sorry I misunderstood your requirement use below array formula (Confirm with shift+Ctrl+Enter)

    Please Login or Register  to view this content.
    Attached Files Attached Files

  14. #14
    Forum Contributor
    Join Date
    05-18-2011
    Location
    Delhi , India
    MS-Off Ver
    Excel 2007
    Posts
    171

    Re: Find sum with multiple conditions of 'top n values of a table'.

    @nflsales : thanks a lot

+ 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-14-2016, 03:53 PM
  2. Find a value in a table with multiple values
    By JonesyCC in forum Excel General
    Replies: 4
    Last Post: 02-18-2014, 05:58 PM
  3. Find a value from array in another table with multiple values
    By ASAFSWIS in forum Excel Formulas & Functions
    Replies: 9
    Last Post: 12-25-2013, 09:19 AM
  4. Find multiple values in pivot table
    By KimC33 in forum Excel General
    Replies: 0
    Last Post: 12-07-2011, 11:03 AM
  5. Insert multiple values from seperate table based on multiple conditions
    By drakesong in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 02-28-2011, 06:04 PM
  6. Nested IFs formula to find matching values with multiple conditions
    By ghuang in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 03-25-2009, 02:02 AM
  7. [SOLVED] look up table values with multiple conditions
    By TechMGR in forum Excel General
    Replies: 3
    Last Post: 01-09-2006, 08:55 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