+ Reply to Thread
Results 1 to 7 of 7

Sum top 5 values based based on flag value

Hybrid View

Snoopy2003 Sum top 5 values based based... 08-07-2012, 03:16 PM
martindwilson Re: Sum top 5 values based... 08-07-2012, 03:44 PM
Cutter Re: Sum top 5 values based... 08-07-2012, 07:41 PM
Snoopy2003 Re: Sum top 5 values based... 08-07-2012, 08:44 PM
Cutter Re: Sum top 5 values based... 08-07-2012, 09:18 PM
martindwilson Re: Sum top 5 values based... 08-08-2012, 02:47 AM
Cutter Re: Sum top 5 values based... 08-08-2012, 10:27 AM
  1. #1
    Forum Contributor
    Join Date
    08-19-2010
    Location
    N/A
    MS-Off Ver
    Excel 2010
    Posts
    151

    Sum top 5 values based based on flag value

    Hello,

    I use the following formula to sum top 5 values in a column:
    =IF(V4>0,SUMPRODUCT((V$11:V$1007>LARGE(V$11:V$1007,6))*(V$11:V$1007)),"")
    I added a flag column: "count Yes/No".

    I wish to sum top 5 values where flag value is "Yes"

    I tried:
    =IF(V4>0,SUMPRODUCT((V$11:V$1007>LARGE(V$11:V$1007,6))*(V$11:V$1007)*(U$11:U$1007="Yes")),"")
    but it does not work.

    Can you help me ?

    Thank you

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

    Re: Sum top 5 values based based on flag value

    =IF(V4>0,SUMPRODUCT((V$11:V$1007>LARGE(V$11:V$1007,6))*(V$11:V$1007)),"") does not sum large 5 in a column
    =SUM(LARGE(V11:V1007,{1,2,3,4,5})) does

    =SUMPRODUCT(LARGE((U11:U1007="y")*(V11:V1007),{1,2,3,4,5}))
    sums the 5 largest where u=y
    Last edited by martindwilson; 08-07-2012 at 03:59 PM.
    "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

  3. #3
    Forum Expert Cutter's Avatar
    Join Date
    05-24-2004
    Location
    Ontario,Canada
    MS-Off Ver
    Excel 2010
    Posts
    6,451

    Re: Sum top 5 values based based on flag value

    What about:

    =SUMIF(V11:V1007,">"&LARGE(V11:V1007,6))

  4. #4
    Forum Contributor
    Join Date
    08-19-2010
    Location
    N/A
    MS-Off Ver
    Excel 2010
    Posts
    151

    Re: Sum top 5 values based based on flag value

    Thank you for your help.

    That solve my problem.

  5. #5
    Forum Expert Cutter's Avatar
    Join Date
    05-24-2004
    Location
    Ontario,Canada
    MS-Off Ver
    Excel 2010
    Posts
    6,451

    Re: Sum top 5 values based based on flag value

    If you're talking to me, you're welcome.

    Please remember to mark your thread as Solved.

    New quick method:
    Select Thread Tools (above first post on page) -> Mark thread as Solved. To undo, select Thread Tools-> Mark thread as Unsolved.

    Or you can use this way:
    Go to the first post
    Click edit
    Click Go Advanced
    Just below the word "Title" you will see a dropdown with the words "No prefix".
    Change to "Solved"
    Click Save

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

    Re: Sum top 5 values based based on flag value

    cutter that fails if the top 6 or more are all the same number or even if say large 5 and 6 are the same then it only sums the top 4

  7. #7
    Forum Expert Cutter's Avatar
    Join Date
    05-24-2004
    Location
    Ontario,Canada
    MS-Off Ver
    Excel 2010
    Posts
    6,451

    Re: Sum top 5 values based based on flag value

    You're right, Martin. I based it on the first formula in the first post and offered it as an alternative to SUMPRODUCT().

    Still don't know which solution was being referred to in post #4.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

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