+ Reply to Thread
Results 1 to 74 of 74

need function to sum top ranking items in list

  1. #1
    Registered User
    Join Date
    06-02-2005
    Posts
    9

    need function to sum top ranking items in list

    How can I make a function that will sum the largest 32 items in a column which meet specific criteria? For example, the largest 32 values that are smaller then X, or are not #N/A? I think I want to use SUMIF, but how can I format the criteria to evaluate a function for each cell?

  2. #2
    Harlan Grove
    Guest

    Re: need function to sum top ranking items in list

    QuantumPion wrote...
    >How can I make a function that will sum the largest 32 items in a column
    >which meet specific criteria? For example, the largest 32 values that
    >are smaller then X, or are not #N/A? I think I want to use SUMIF, but
    >how can I format the criteria to evaluate a function for each cell?


    SUMIF only provides one criterion. Use the array formula

    =SUM(LARGE(IF(ISNUMBER(List),IF(List<X,List)),ROW(INDIRECT("1:32"))))


  3. #3
    Bob Phillips
    Guest

    Re: need function to sum top ranking items in list

    Here is an example that sums the top 32 that are not equal to 35

    =SUMPRODUCT(--(LARGE(IF(A1:A40<>35,A1:A40),ROW(INDIRECT("1:32")))))

    it is an array formula, so commit with Ctrl-Shift-Enter

    --
    HTH

    Bob Phillips

    "QuantumPion" <[email protected]>
    wrote in message
    news:[email protected]...
    >
    > How can I make a function that will sum the largest 32 items in a column
    > which meet specific criteria? For example, the largest 32 values that
    > are smaller then X, or are not #N/A? I think I want to use SUMIF, but
    > how can I format the criteria to evaluate a function for each cell?
    >
    >
    > --
    > QuantumPion
    > ------------------------------------------------------------------------
    > QuantumPion's Profile:

    http://www.excelforum.com/member.php...o&userid=23991
    > View this thread: http://www.excelforum.com/showthread...hreadid=376101
    >




  4. #4
    JE McGimpsey
    Guest

    Re: need function to sum top ranking items in list

    One way (array-entered: CTRL-SHIFT-ENTER or CMD-RETURN):

    =SUM(LARGE(IF(IF(ISNUMBER(rng),rng)<X,IF(ISNUMBER(rng),rng,0)),
    ROW(INDIRECT("1:32"))))

    In article <[email protected]>,
    QuantumPion <[email protected]>
    wrote:

    > How can I make a function that will sum the largest 32 items in a column
    > which meet specific criteria? For example, the largest 32 values that
    > are smaller then X, or are not #N/A? I think I want to use SUMIF, but
    > how can I format the criteria to evaluate a function for each cell?


  5. #5
    Harlan Grove
    Guest

    Re: need function to sum top ranking items in list

    Bob Phillips wrote...
    >Here is an example that sums the top 32 that are not equal to 35
    >
    >=SUMPRODUCT(--(LARGE(IF(A1:A40<>35,A1:A40),ROW(INDIRECT("1:32")))))
    >
    >it is an array formula, so commit with Ctrl-Shift-Enter

    ....

    If it has to be an array formula, no point using SUMPRODUCT rather than
    SUM. Also, LARGE only returns numbers, so no need for the '--' or the
    parentheses enclosing the LARGE call.

    =SUM(LARGE(IF(A1:A40<>35,A1:A40),ROW(INDIRECT("1:32"))))


  6. #6
    Registered User
    Join Date
    06-02-2005
    Posts
    9
    Here is a more detailed explanation. I need a function that will sum the n largest values in an array, where the values are less then x and are not #N/A, meet a criteria in a seperate array, and where the total of the sum is less then or equal to y. How can I do this? Thanks.

    For example, here is my data:

    Please Login or Register  to view this content.
    I want a function that will find the sum of the largest two values that are "g" that add to 8 or less. So the output would look like:

    Please Login or Register  to view this content.
    Last edited by QuantumPion; 06-02-2005 at 05:40 PM.

  7. #7
    Registered User
    Join Date
    06-02-2005
    Posts
    9
    now that I think about it, this is much more complicated. I have multiple "value" columns for different dates. And I need to pick the highest 32 items that meet the criteria for each date, but none of the items can be used twice. So an additional criteria is that none of the 32 items could have been used in the previous column. Bleh! I'll probably have to do this manually.

  8. #8
    JE McGimpsey
    Guest

    Re: need function to sum top ranking items in list

    That fails under the OP's "not #N/A" criterion.

    In article <[email protected]>,
    "Bob Phillips" <[email protected]> wrote:

    > Here is an example that sums the top 32 that are not equal to 35
    >
    > =SUMPRODUCT(--(LARGE(IF(A1:A40<>35,A1:A40),ROW(INDIRECT("1:32")))))
    >
    > it is an array formula, so commit with Ctrl-Shift-Enter
    >
    > --
    > HTH
    >
    > Bob Phillips
    >
    > "QuantumPion" <[email protected]>
    > wrote in message
    > news:[email protected]...
    > >
    > > How can I make a function that will sum the largest 32 items in a column
    > > which meet specific criteria? For example, the largest 32 values that
    > > are smaller then X, or are not #N/A? I think I want to use SUMIF, but
    > > how can I format the criteria to evaluate a function for each cell?


  9. #9
    JE McGimpsey
    Guest

    Re: need function to sum top ranking items in list

    In article <[email protected]>,
    "Harlan Grove" <[email protected]> wrote:

    > QuantumPion wrote...
    > >How can I make a function that will sum the largest 32 items in a column
    > >which meet specific criteria? For example, the largest 32 values that
    > >are smaller then X, or are not #N/A? I think I want to use SUMIF, but
    > >how can I format the criteria to evaluate a function for each cell?

    >
    > SUMIF only provides one criterion. Use the array formula
    >
    > =SUM(LARGE(IF(ISNUMBER(List),IF(List<X,List)),ROW(INDIRECT("1:32"))))


    Note that returns #N/A if the List contains #N/A...

  10. #10
    Harlan Grove
    Guest

    Re: need function to sum top ranking items in list

    JE McGimpsey wrote...
    >"Harlan Grove" <[email protected]> wrote:

    ....
    >>SUMIF only provides one criterion. Use the array formula
    >>
    >>=SUM(LARGE(IF(ISNUMBER(List),IF(List<X,List)),ROW(INDIRECT("1:32"))))

    >
    >Note that returns #N/A if the List contains #N/A...


    Did you test that assertion? Apparently not.

    Note that I use *2* *nested* IF calls. The first in effect passes only
    numbers on to the second. Any #N/A in List (or any other error values,
    text or boolean values) will produce a FALSE value in the result array
    from the outer IF call.

    A simplified example, if A1:A6 contained

    1
    #N/A
    3
    4
    5
    6

    and B1 contained the *ARRAY* formula

    =SUM(LARGE(IF(ISNUMBER(A1:A6),IF(A1:A6<5,A1:A6)),ROW(INDIRECT("1:2"))))

    the formula would return 7, not #N/A, because the formula would
    evaluate as

    =SUM(LARGE(IF(ISNUMBER({1;#N/A;3;4;5;6}),
    IF({1;#N/A;3;4;5;6}<5,{1;#N/A;3;4;5;6})),{1;2}))

    =SUM(LARGE(IF({TRUE;FALSE;TRUE;TRUE;TRUE;TRUE},
    IF({TRUE;#N/A;TRUE;TRUE;FALSE;FALSE},{1;#N/A;3;4;5;6})),{1;2}))

    =SUM(LARGE(IF({TRUE;FALSE;TRUE;TRUE;TRUE;TRUE},
    {1;#N/A;3;4;FALSE;FALSE}),{1;2}))

    =SUM(LARGE({1;FALSE;3;4;FALSE;FALSE},{1;2}))

    =SUM({4;3})

    =7


  11. #11
    Harlan Grove
    Guest

    Re: need function to sum top ranking items in list

    JE McGimpsey wrote...
    >One way (array-entered: CTRL-SHIFT-ENTER or CMD-RETURN):
    >
    >=SUM(LARGE(IF(IF(ISNUMBER(rng),rng)<X,IF(ISNUMBER(rng),rng,0)),
    >ROW(INDIRECT("1:32"))))

    ....

    IF X is a number, the 3rd IF call, IF(ISNUMBER(rng),rng,0), is
    unnecessary and should be replaced with just rng. Note that this relies
    on the obscure fact that FALSE evaluates greater than any number value.


  12. #12
    JE McGimpsey
    Guest

    Re: need function to sum top ranking items in list

    True. Thanks for the correction!

    In article <[email protected]>,
    "Harlan Grove" <[email protected]> wrote:

    > IF X is a number, the 3rd IF call, IF(ISNUMBER(rng),rng,0), is
    > unnecessary and should be replaced with just rng. Note that this relies
    > on the obscure fact that FALSE evaluates greater than any number value.


  13. #13
    JE McGimpsey
    Guest

    Re: need function to sum top ranking items in list

    Actually I did, but I can't replicate it - must have been the same
    problem that caused me to add the extra if() in my formula.

    Sorry!

    In article <[email protected]>,
    "Harlan Grove" <[email protected]> wrote:

    > Did you test that assertion? Apparently not.
    >


  14. #14
    Registered User
    Join Date
    06-02-2005
    Posts
    9
    My problem is trying to make a forumla that adds the highest values that total less then a limit though. What I need is a way to repeat a forumla until a result is achieved, sort of like:

    if(sum(rank(1:32)>1500,if(sum(rank(2:33)>1500,if(sum(rank(3:34)>1500, ... ad nausem.

  15. #15
    JE McGimpsey
    Guest

    Re: need function to sum top ranking items in list

    In article <[email protected]>,
    "Harlan Grove" <[email protected]> wrote:

    > QuantumPion wrote...
    > >How can I make a function that will sum the largest 32 items in a column
    > >which meet specific criteria? For example, the largest 32 values that
    > >are smaller then X, or are not #N/A? I think I want to use SUMIF, but
    > >how can I format the criteria to evaluate a function for each cell?

    >
    > SUMIF only provides one criterion. Use the array formula
    >
    > =SUM(LARGE(IF(ISNUMBER(List),IF(List<X,List)),ROW(INDIRECT("1:32"))))


    Note that returns #N/A if the List contains #N/A...

  16. #16
    JE McGimpsey
    Guest

    Re: need function to sum top ranking items in list

    Actually I did, but I can't replicate it - must have been the same
    problem that caused me to add the extra if() in my formula.

    Sorry!

    In article <[email protected]>,
    "Harlan Grove" <[email protected]> wrote:

    > Did you test that assertion? Apparently not.
    >


  17. #17
    JE McGimpsey
    Guest

    Re: need function to sum top ranking items in list

    True. Thanks for the correction!

    In article <[email protected]>,
    "Harlan Grove" <[email protected]> wrote:

    > IF X is a number, the 3rd IF call, IF(ISNUMBER(rng),rng,0), is
    > unnecessary and should be replaced with just rng. Note that this relies
    > on the obscure fact that FALSE evaluates greater than any number value.


  18. #18
    Harlan Grove
    Guest

    Re: need function to sum top ranking items in list

    JE McGimpsey wrote...
    >One way (array-entered: CTRL-SHIFT-ENTER or CMD-RETURN):
    >
    >=SUM(LARGE(IF(IF(ISNUMBER(rng),rng)<X,IF(ISNUMBER(rng),rng,0)),
    >ROW(INDIRECT("1:32"))))

    ....

    IF X is a number, the 3rd IF call, IF(ISNUMBER(rng),rng,0), is
    unnecessary and should be replaced with just rng. Note that this relies
    on the obscure fact that FALSE evaluates greater than any number value.


  19. #19
    Harlan Grove
    Guest

    Re: need function to sum top ranking items in list

    JE McGimpsey wrote...
    >"Harlan Grove" <[email protected]> wrote:

    ....
    >>SUMIF only provides one criterion. Use the array formula
    >>
    >>=SUM(LARGE(IF(ISNUMBER(List),IF(List<X,List)),ROW(INDIRECT("1:32"))))

    >
    >Note that returns #N/A if the List contains #N/A...


    Did you test that assertion? Apparently not.

    Note that I use *2* *nested* IF calls. The first in effect passes only
    numbers on to the second. Any #N/A in List (or any other error values,
    text or boolean values) will produce a FALSE value in the result array
    from the outer IF call.

    A simplified example, if A1:A6 contained

    1
    #N/A
    3
    4
    5
    6

    and B1 contained the *ARRAY* formula

    =SUM(LARGE(IF(ISNUMBER(A1:A6),IF(A1:A6<5,A1:A6)),ROW(INDIRECT("1:2"))))

    the formula would return 7, not #N/A, because the formula would
    evaluate as

    =SUM(LARGE(IF(ISNUMBER({1;#N/A;3;4;5;6}),
    IF({1;#N/A;3;4;5;6}<5,{1;#N/A;3;4;5;6})),{1;2}))

    =SUM(LARGE(IF({TRUE;FALSE;TRUE;TRUE;TRUE;TRUE},
    IF({TRUE;#N/A;TRUE;TRUE;FALSE;FALSE},{1;#N/A;3;4;5;6})),{1;2}))

    =SUM(LARGE(IF({TRUE;FALSE;TRUE;TRUE;TRUE;TRUE},
    {1;#N/A;3;4;FALSE;FALSE}),{1;2}))

    =SUM(LARGE({1;FALSE;3;4;FALSE;FALSE},{1;2}))

    =SUM({4;3})

    =7


  20. #20
    JE McGimpsey
    Guest

    Re: need function to sum top ranking items in list

    That fails under the OP's "not #N/A" criterion.

    In article <[email protected]>,
    "Bob Phillips" <[email protected]> wrote:

    > Here is an example that sums the top 32 that are not equal to 35
    >
    > =SUMPRODUCT(--(LARGE(IF(A1:A40<>35,A1:A40),ROW(INDIRECT("1:32")))))
    >
    > it is an array formula, so commit with Ctrl-Shift-Enter
    >
    > --
    > HTH
    >
    > Bob Phillips
    >
    > "QuantumPion" <[email protected]>
    > wrote in message
    > news:[email protected]...
    > >
    > > How can I make a function that will sum the largest 32 items in a column
    > > which meet specific criteria? For example, the largest 32 values that
    > > are smaller then X, or are not #N/A? I think I want to use SUMIF, but
    > > how can I format the criteria to evaluate a function for each cell?


  21. #21
    Harlan Grove
    Guest

    Re: need function to sum top ranking items in list

    Bob Phillips wrote...
    >Here is an example that sums the top 32 that are not equal to 35
    >
    >=SUMPRODUCT(--(LARGE(IF(A1:A40<>35,A1:A40),ROW(INDIRECT("1:32")))))
    >
    >it is an array formula, so commit with Ctrl-Shift-Enter

    ....

    If it has to be an array formula, no point using SUMPRODUCT rather than
    SUM. Also, LARGE only returns numbers, so no need for the '--' or the
    parentheses enclosing the LARGE call.

    =SUM(LARGE(IF(A1:A40<>35,A1:A40),ROW(INDIRECT("1:32"))))


  22. #22
    JE McGimpsey
    Guest

    Re: need function to sum top ranking items in list

    One way (array-entered: CTRL-SHIFT-ENTER or CMD-RETURN):

    =SUM(LARGE(IF(IF(ISNUMBER(rng),rng)<X,IF(ISNUMBER(rng),rng,0)),
    ROW(INDIRECT("1:32"))))

    In article <[email protected]>,
    QuantumPion <[email protected]>
    wrote:

    > How can I make a function that will sum the largest 32 items in a column
    > which meet specific criteria? For example, the largest 32 values that
    > are smaller then X, or are not #N/A? I think I want to use SUMIF, but
    > how can I format the criteria to evaluate a function for each cell?


  23. #23
    Bob Phillips
    Guest

    Re: need function to sum top ranking items in list

    Here is an example that sums the top 32 that are not equal to 35

    =SUMPRODUCT(--(LARGE(IF(A1:A40<>35,A1:A40),ROW(INDIRECT("1:32")))))

    it is an array formula, so commit with Ctrl-Shift-Enter

    --
    HTH

    Bob Phillips

    "QuantumPion" <[email protected]>
    wrote in message
    news:[email protected]...
    >
    > How can I make a function that will sum the largest 32 items in a column
    > which meet specific criteria? For example, the largest 32 values that
    > are smaller then X, or are not #N/A? I think I want to use SUMIF, but
    > how can I format the criteria to evaluate a function for each cell?
    >
    >
    > --
    > QuantumPion
    > ------------------------------------------------------------------------
    > QuantumPion's Profile:

    http://www.excelforum.com/member.php...o&userid=23991
    > View this thread: http://www.excelforum.com/showthread...hreadid=376101
    >




  24. #24
    Harlan Grove
    Guest

    Re: need function to sum top ranking items in list

    QuantumPion wrote...
    >How can I make a function that will sum the largest 32 items in a column
    >which meet specific criteria? For example, the largest 32 values that
    >are smaller then X, or are not #N/A? I think I want to use SUMIF, but
    >how can I format the criteria to evaluate a function for each cell?


    SUMIF only provides one criterion. Use the array formula

    =SUM(LARGE(IF(ISNUMBER(List),IF(List<X,List)),ROW(INDIRECT("1:32"))))


  25. #25
    JE McGimpsey
    Guest

    Re: need function to sum top ranking items in list

    In article <[email protected]>,
    "Harlan Grove" <[email protected]> wrote:

    > QuantumPion wrote...
    > >How can I make a function that will sum the largest 32 items in a column
    > >which meet specific criteria? For example, the largest 32 values that
    > >are smaller then X, or are not #N/A? I think I want to use SUMIF, but
    > >how can I format the criteria to evaluate a function for each cell?

    >
    > SUMIF only provides one criterion. Use the array formula
    >
    > =SUM(LARGE(IF(ISNUMBER(List),IF(List<X,List)),ROW(INDIRECT("1:32"))))


    Note that returns #N/A if the List contains #N/A...

  26. #26
    JE McGimpsey
    Guest

    Re: need function to sum top ranking items in list

    Actually I did, but I can't replicate it - must have been the same
    problem that caused me to add the extra if() in my formula.

    Sorry!

    In article <[email protected]>,
    "Harlan Grove" <[email protected]> wrote:

    > Did you test that assertion? Apparently not.
    >


  27. #27
    JE McGimpsey
    Guest

    Re: need function to sum top ranking items in list

    True. Thanks for the correction!

    In article <[email protected]>,
    "Harlan Grove" <[email protected]> wrote:

    > IF X is a number, the 3rd IF call, IF(ISNUMBER(rng),rng,0), is
    > unnecessary and should be replaced with just rng. Note that this relies
    > on the obscure fact that FALSE evaluates greater than any number value.


  28. #28
    Harlan Grove
    Guest

    Re: need function to sum top ranking items in list

    JE McGimpsey wrote...
    >One way (array-entered: CTRL-SHIFT-ENTER or CMD-RETURN):
    >
    >=SUM(LARGE(IF(IF(ISNUMBER(rng),rng)<X,IF(ISNUMBER(rng),rng,0)),
    >ROW(INDIRECT("1:32"))))

    ....

    IF X is a number, the 3rd IF call, IF(ISNUMBER(rng),rng,0), is
    unnecessary and should be replaced with just rng. Note that this relies
    on the obscure fact that FALSE evaluates greater than any number value.


  29. #29
    Harlan Grove
    Guest

    Re: need function to sum top ranking items in list

    JE McGimpsey wrote...
    >"Harlan Grove" <[email protected]> wrote:

    ....
    >>SUMIF only provides one criterion. Use the array formula
    >>
    >>=SUM(LARGE(IF(ISNUMBER(List),IF(List<X,List)),ROW(INDIRECT("1:32"))))

    >
    >Note that returns #N/A if the List contains #N/A...


    Did you test that assertion? Apparently not.

    Note that I use *2* *nested* IF calls. The first in effect passes only
    numbers on to the second. Any #N/A in List (or any other error values,
    text or boolean values) will produce a FALSE value in the result array
    from the outer IF call.

    A simplified example, if A1:A6 contained

    1
    #N/A
    3
    4
    5
    6

    and B1 contained the *ARRAY* formula

    =SUM(LARGE(IF(ISNUMBER(A1:A6),IF(A1:A6<5,A1:A6)),ROW(INDIRECT("1:2"))))

    the formula would return 7, not #N/A, because the formula would
    evaluate as

    =SUM(LARGE(IF(ISNUMBER({1;#N/A;3;4;5;6}),
    IF({1;#N/A;3;4;5;6}<5,{1;#N/A;3;4;5;6})),{1;2}))

    =SUM(LARGE(IF({TRUE;FALSE;TRUE;TRUE;TRUE;TRUE},
    IF({TRUE;#N/A;TRUE;TRUE;FALSE;FALSE},{1;#N/A;3;4;5;6})),{1;2}))

    =SUM(LARGE(IF({TRUE;FALSE;TRUE;TRUE;TRUE;TRUE},
    {1;#N/A;3;4;FALSE;FALSE}),{1;2}))

    =SUM(LARGE({1;FALSE;3;4;FALSE;FALSE},{1;2}))

    =SUM({4;3})

    =7


  30. #30
    JE McGimpsey
    Guest

    Re: need function to sum top ranking items in list

    That fails under the OP's "not #N/A" criterion.

    In article <[email protected]>,
    "Bob Phillips" <[email protected]> wrote:

    > Here is an example that sums the top 32 that are not equal to 35
    >
    > =SUMPRODUCT(--(LARGE(IF(A1:A40<>35,A1:A40),ROW(INDIRECT("1:32")))))
    >
    > it is an array formula, so commit with Ctrl-Shift-Enter
    >
    > --
    > HTH
    >
    > Bob Phillips
    >
    > "QuantumPion" <[email protected]>
    > wrote in message
    > news:[email protected]...
    > >
    > > How can I make a function that will sum the largest 32 items in a column
    > > which meet specific criteria? For example, the largest 32 values that
    > > are smaller then X, or are not #N/A? I think I want to use SUMIF, but
    > > how can I format the criteria to evaluate a function for each cell?


  31. #31
    Harlan Grove
    Guest

    Re: need function to sum top ranking items in list

    Bob Phillips wrote...
    >Here is an example that sums the top 32 that are not equal to 35
    >
    >=SUMPRODUCT(--(LARGE(IF(A1:A40<>35,A1:A40),ROW(INDIRECT("1:32")))))
    >
    >it is an array formula, so commit with Ctrl-Shift-Enter

    ....

    If it has to be an array formula, no point using SUMPRODUCT rather than
    SUM. Also, LARGE only returns numbers, so no need for the '--' or the
    parentheses enclosing the LARGE call.

    =SUM(LARGE(IF(A1:A40<>35,A1:A40),ROW(INDIRECT("1:32"))))


  32. #32
    JE McGimpsey
    Guest

    Re: need function to sum top ranking items in list

    One way (array-entered: CTRL-SHIFT-ENTER or CMD-RETURN):

    =SUM(LARGE(IF(IF(ISNUMBER(rng),rng)<X,IF(ISNUMBER(rng),rng,0)),
    ROW(INDIRECT("1:32"))))

    In article <[email protected]>,
    QuantumPion <[email protected]>
    wrote:

    > How can I make a function that will sum the largest 32 items in a column
    > which meet specific criteria? For example, the largest 32 values that
    > are smaller then X, or are not #N/A? I think I want to use SUMIF, but
    > how can I format the criteria to evaluate a function for each cell?


  33. #33
    Bob Phillips
    Guest

    Re: need function to sum top ranking items in list

    Here is an example that sums the top 32 that are not equal to 35

    =SUMPRODUCT(--(LARGE(IF(A1:A40<>35,A1:A40),ROW(INDIRECT("1:32")))))

    it is an array formula, so commit with Ctrl-Shift-Enter

    --
    HTH

    Bob Phillips

    "QuantumPion" <[email protected]>
    wrote in message
    news:[email protected]...
    >
    > How can I make a function that will sum the largest 32 items in a column
    > which meet specific criteria? For example, the largest 32 values that
    > are smaller then X, or are not #N/A? I think I want to use SUMIF, but
    > how can I format the criteria to evaluate a function for each cell?
    >
    >
    > --
    > QuantumPion
    > ------------------------------------------------------------------------
    > QuantumPion's Profile:

    http://www.excelforum.com/member.php...o&userid=23991
    > View this thread: http://www.excelforum.com/showthread...hreadid=376101
    >




  34. #34
    Harlan Grove
    Guest

    Re: need function to sum top ranking items in list

    QuantumPion wrote...
    >How can I make a function that will sum the largest 32 items in a column
    >which meet specific criteria? For example, the largest 32 values that
    >are smaller then X, or are not #N/A? I think I want to use SUMIF, but
    >how can I format the criteria to evaluate a function for each cell?


    SUMIF only provides one criterion. Use the array formula

    =SUM(LARGE(IF(ISNUMBER(List),IF(List<X,List)),ROW(INDIRECT("1:32"))))


  35. #35
    Harlan Grove
    Guest

    Re: need function to sum top ranking items in list

    Bob Phillips wrote...
    >Here is an example that sums the top 32 that are not equal to 35
    >
    >=SUMPRODUCT(--(LARGE(IF(A1:A40<>35,A1:A40),ROW(INDIRECT("1:32")))))
    >
    >it is an array formula, so commit with Ctrl-Shift-Enter

    ....

    If it has to be an array formula, no point using SUMPRODUCT rather than
    SUM. Also, LARGE only returns numbers, so no need for the '--' or the
    parentheses enclosing the LARGE call.

    =SUM(LARGE(IF(A1:A40<>35,A1:A40),ROW(INDIRECT("1:32"))))


  36. #36
    JE McGimpsey
    Guest

    Re: need function to sum top ranking items in list

    Actually I did, but I can't replicate it - must have been the same
    problem that caused me to add the extra if() in my formula.

    Sorry!

    In article <[email protected]>,
    "Harlan Grove" <[email protected]> wrote:

    > Did you test that assertion? Apparently not.
    >


  37. #37
    JE McGimpsey
    Guest

    Re: need function to sum top ranking items in list

    True. Thanks for the correction!

    In article <[email protected]>,
    "Harlan Grove" <[email protected]> wrote:

    > IF X is a number, the 3rd IF call, IF(ISNUMBER(rng),rng,0), is
    > unnecessary and should be replaced with just rng. Note that this relies
    > on the obscure fact that FALSE evaluates greater than any number value.


  38. #38
    Harlan Grove
    Guest

    Re: need function to sum top ranking items in list

    JE McGimpsey wrote...
    >One way (array-entered: CTRL-SHIFT-ENTER or CMD-RETURN):
    >
    >=SUM(LARGE(IF(IF(ISNUMBER(rng),rng)<X,IF(ISNUMBER(rng),rng,0)),
    >ROW(INDIRECT("1:32"))))

    ....

    IF X is a number, the 3rd IF call, IF(ISNUMBER(rng),rng,0), is
    unnecessary and should be replaced with just rng. Note that this relies
    on the obscure fact that FALSE evaluates greater than any number value.


  39. #39
    Harlan Grove
    Guest

    Re: need function to sum top ranking items in list

    JE McGimpsey wrote...
    >"Harlan Grove" <[email protected]> wrote:

    ....
    >>SUMIF only provides one criterion. Use the array formula
    >>
    >>=SUM(LARGE(IF(ISNUMBER(List),IF(List<X,List)),ROW(INDIRECT("1:32"))))

    >
    >Note that returns #N/A if the List contains #N/A...


    Did you test that assertion? Apparently not.

    Note that I use *2* *nested* IF calls. The first in effect passes only
    numbers on to the second. Any #N/A in List (or any other error values,
    text or boolean values) will produce a FALSE value in the result array
    from the outer IF call.

    A simplified example, if A1:A6 contained

    1
    #N/A
    3
    4
    5
    6

    and B1 contained the *ARRAY* formula

    =SUM(LARGE(IF(ISNUMBER(A1:A6),IF(A1:A6<5,A1:A6)),ROW(INDIRECT("1:2"))))

    the formula would return 7, not #N/A, because the formula would
    evaluate as

    =SUM(LARGE(IF(ISNUMBER({1;#N/A;3;4;5;6}),
    IF({1;#N/A;3;4;5;6}<5,{1;#N/A;3;4;5;6})),{1;2}))

    =SUM(LARGE(IF({TRUE;FALSE;TRUE;TRUE;TRUE;TRUE},
    IF({TRUE;#N/A;TRUE;TRUE;FALSE;FALSE},{1;#N/A;3;4;5;6})),{1;2}))

    =SUM(LARGE(IF({TRUE;FALSE;TRUE;TRUE;TRUE;TRUE},
    {1;#N/A;3;4;FALSE;FALSE}),{1;2}))

    =SUM(LARGE({1;FALSE;3;4;FALSE;FALSE},{1;2}))

    =SUM({4;3})

    =7


  40. #40
    JE McGimpsey
    Guest

    Re: need function to sum top ranking items in list

    That fails under the OP's "not #N/A" criterion.

    In article <[email protected]>,
    "Bob Phillips" <[email protected]> wrote:

    > Here is an example that sums the top 32 that are not equal to 35
    >
    > =SUMPRODUCT(--(LARGE(IF(A1:A40<>35,A1:A40),ROW(INDIRECT("1:32")))))
    >
    > it is an array formula, so commit with Ctrl-Shift-Enter
    >
    > --
    > HTH
    >
    > Bob Phillips
    >
    > "QuantumPion" <[email protected]>
    > wrote in message
    > news:[email protected]...
    > >
    > > How can I make a function that will sum the largest 32 items in a column
    > > which meet specific criteria? For example, the largest 32 values that
    > > are smaller then X, or are not #N/A? I think I want to use SUMIF, but
    > > how can I format the criteria to evaluate a function for each cell?


  41. #41
    JE McGimpsey
    Guest

    Re: need function to sum top ranking items in list

    One way (array-entered: CTRL-SHIFT-ENTER or CMD-RETURN):

    =SUM(LARGE(IF(IF(ISNUMBER(rng),rng)<X,IF(ISNUMBER(rng),rng,0)),
    ROW(INDIRECT("1:32"))))

    In article <[email protected]>,
    QuantumPion <[email protected]>
    wrote:

    > How can I make a function that will sum the largest 32 items in a column
    > which meet specific criteria? For example, the largest 32 values that
    > are smaller then X, or are not #N/A? I think I want to use SUMIF, but
    > how can I format the criteria to evaluate a function for each cell?


  42. #42
    Bob Phillips
    Guest

    Re: need function to sum top ranking items in list

    Here is an example that sums the top 32 that are not equal to 35

    =SUMPRODUCT(--(LARGE(IF(A1:A40<>35,A1:A40),ROW(INDIRECT("1:32")))))

    it is an array formula, so commit with Ctrl-Shift-Enter

    --
    HTH

    Bob Phillips

    "QuantumPion" <[email protected]>
    wrote in message
    news:[email protected]...
    >
    > How can I make a function that will sum the largest 32 items in a column
    > which meet specific criteria? For example, the largest 32 values that
    > are smaller then X, or are not #N/A? I think I want to use SUMIF, but
    > how can I format the criteria to evaluate a function for each cell?
    >
    >
    > --
    > QuantumPion
    > ------------------------------------------------------------------------
    > QuantumPion's Profile:

    http://www.excelforum.com/member.php...o&userid=23991
    > View this thread: http://www.excelforum.com/showthread...hreadid=376101
    >




  43. #43
    Harlan Grove
    Guest

    Re: need function to sum top ranking items in list

    QuantumPion wrote...
    >How can I make a function that will sum the largest 32 items in a column
    >which meet specific criteria? For example, the largest 32 values that
    >are smaller then X, or are not #N/A? I think I want to use SUMIF, but
    >how can I format the criteria to evaluate a function for each cell?


    SUMIF only provides one criterion. Use the array formula

    =SUM(LARGE(IF(ISNUMBER(List),IF(List<X,List)),ROW(INDIRECT("1:32"))))


  44. #44
    JE McGimpsey
    Guest

    Re: need function to sum top ranking items in list

    In article <[email protected]>,
    "Harlan Grove" <[email protected]> wrote:

    > QuantumPion wrote...
    > >How can I make a function that will sum the largest 32 items in a column
    > >which meet specific criteria? For example, the largest 32 values that
    > >are smaller then X, or are not #N/A? I think I want to use SUMIF, but
    > >how can I format the criteria to evaluate a function for each cell?

    >
    > SUMIF only provides one criterion. Use the array formula
    >
    > =SUM(LARGE(IF(ISNUMBER(List),IF(List<X,List)),ROW(INDIRECT("1:32"))))


    Note that returns #N/A if the List contains #N/A...

  45. #45
    JE McGimpsey
    Guest

    Re: need function to sum top ranking items in list

    In article <[email protected]>,
    "Harlan Grove" <[email protected]> wrote:

    > QuantumPion wrote...
    > >How can I make a function that will sum the largest 32 items in a column
    > >which meet specific criteria? For example, the largest 32 values that
    > >are smaller then X, or are not #N/A? I think I want to use SUMIF, but
    > >how can I format the criteria to evaluate a function for each cell?

    >
    > SUMIF only provides one criterion. Use the array formula
    >
    > =SUM(LARGE(IF(ISNUMBER(List),IF(List<X,List)),ROW(INDIRECT("1:32"))))


    Note that returns #N/A if the List contains #N/A...

  46. #46
    JE McGimpsey
    Guest

    Re: need function to sum top ranking items in list

    Actually I did, but I can't replicate it - must have been the same
    problem that caused me to add the extra if() in my formula.

    Sorry!

    In article <[email protected]>,
    "Harlan Grove" <[email protected]> wrote:

    > Did you test that assertion? Apparently not.
    >


  47. #47
    JE McGimpsey
    Guest

    Re: need function to sum top ranking items in list

    True. Thanks for the correction!

    In article <[email protected]>,
    "Harlan Grove" <[email protected]> wrote:

    > IF X is a number, the 3rd IF call, IF(ISNUMBER(rng),rng,0), is
    > unnecessary and should be replaced with just rng. Note that this relies
    > on the obscure fact that FALSE evaluates greater than any number value.


  48. #48
    Harlan Grove
    Guest

    Re: need function to sum top ranking items in list

    JE McGimpsey wrote...
    >One way (array-entered: CTRL-SHIFT-ENTER or CMD-RETURN):
    >
    >=SUM(LARGE(IF(IF(ISNUMBER(rng),rng)<X,IF(ISNUMBER(rng),rng,0)),
    >ROW(INDIRECT("1:32"))))

    ....

    IF X is a number, the 3rd IF call, IF(ISNUMBER(rng),rng,0), is
    unnecessary and should be replaced with just rng. Note that this relies
    on the obscure fact that FALSE evaluates greater than any number value.


  49. #49
    Harlan Grove
    Guest

    Re: need function to sum top ranking items in list

    JE McGimpsey wrote...
    >"Harlan Grove" <[email protected]> wrote:

    ....
    >>SUMIF only provides one criterion. Use the array formula
    >>
    >>=SUM(LARGE(IF(ISNUMBER(List),IF(List<X,List)),ROW(INDIRECT("1:32"))))

    >
    >Note that returns #N/A if the List contains #N/A...


    Did you test that assertion? Apparently not.

    Note that I use *2* *nested* IF calls. The first in effect passes only
    numbers on to the second. Any #N/A in List (or any other error values,
    text or boolean values) will produce a FALSE value in the result array
    from the outer IF call.

    A simplified example, if A1:A6 contained

    1
    #N/A
    3
    4
    5
    6

    and B1 contained the *ARRAY* formula

    =SUM(LARGE(IF(ISNUMBER(A1:A6),IF(A1:A6<5,A1:A6)),ROW(INDIRECT("1:2"))))

    the formula would return 7, not #N/A, because the formula would
    evaluate as

    =SUM(LARGE(IF(ISNUMBER({1;#N/A;3;4;5;6}),
    IF({1;#N/A;3;4;5;6}<5,{1;#N/A;3;4;5;6})),{1;2}))

    =SUM(LARGE(IF({TRUE;FALSE;TRUE;TRUE;TRUE;TRUE},
    IF({TRUE;#N/A;TRUE;TRUE;FALSE;FALSE},{1;#N/A;3;4;5;6})),{1;2}))

    =SUM(LARGE(IF({TRUE;FALSE;TRUE;TRUE;TRUE;TRUE},
    {1;#N/A;3;4;FALSE;FALSE}),{1;2}))

    =SUM(LARGE({1;FALSE;3;4;FALSE;FALSE},{1;2}))

    =SUM({4;3})

    =7


  50. #50
    JE McGimpsey
    Guest

    Re: need function to sum top ranking items in list

    That fails under the OP's "not #N/A" criterion.

    In article <[email protected]>,
    "Bob Phillips" <[email protected]> wrote:

    > Here is an example that sums the top 32 that are not equal to 35
    >
    > =SUMPRODUCT(--(LARGE(IF(A1:A40<>35,A1:A40),ROW(INDIRECT("1:32")))))
    >
    > it is an array formula, so commit with Ctrl-Shift-Enter
    >
    > --
    > HTH
    >
    > Bob Phillips
    >
    > "QuantumPion" <[email protected]>
    > wrote in message
    > news:[email protected]...
    > >
    > > How can I make a function that will sum the largest 32 items in a column
    > > which meet specific criteria? For example, the largest 32 values that
    > > are smaller then X, or are not #N/A? I think I want to use SUMIF, but
    > > how can I format the criteria to evaluate a function for each cell?


  51. #51
    Harlan Grove
    Guest

    Re: need function to sum top ranking items in list

    Bob Phillips wrote...
    >Here is an example that sums the top 32 that are not equal to 35
    >
    >=SUMPRODUCT(--(LARGE(IF(A1:A40<>35,A1:A40),ROW(INDIRECT("1:32")))))
    >
    >it is an array formula, so commit with Ctrl-Shift-Enter

    ....

    If it has to be an array formula, no point using SUMPRODUCT rather than
    SUM. Also, LARGE only returns numbers, so no need for the '--' or the
    parentheses enclosing the LARGE call.

    =SUM(LARGE(IF(A1:A40<>35,A1:A40),ROW(INDIRECT("1:32"))))


  52. #52
    JE McGimpsey
    Guest

    Re: need function to sum top ranking items in list

    One way (array-entered: CTRL-SHIFT-ENTER or CMD-RETURN):

    =SUM(LARGE(IF(IF(ISNUMBER(rng),rng)<X,IF(ISNUMBER(rng),rng,0)),
    ROW(INDIRECT("1:32"))))

    In article <[email protected]>,
    QuantumPion <[email protected]>
    wrote:

    > How can I make a function that will sum the largest 32 items in a column
    > which meet specific criteria? For example, the largest 32 values that
    > are smaller then X, or are not #N/A? I think I want to use SUMIF, but
    > how can I format the criteria to evaluate a function for each cell?


  53. #53
    Bob Phillips
    Guest

    Re: need function to sum top ranking items in list

    Here is an example that sums the top 32 that are not equal to 35

    =SUMPRODUCT(--(LARGE(IF(A1:A40<>35,A1:A40),ROW(INDIRECT("1:32")))))

    it is an array formula, so commit with Ctrl-Shift-Enter

    --
    HTH

    Bob Phillips

    "QuantumPion" <[email protected]>
    wrote in message
    news:[email protected]...
    >
    > How can I make a function that will sum the largest 32 items in a column
    > which meet specific criteria? For example, the largest 32 values that
    > are smaller then X, or are not #N/A? I think I want to use SUMIF, but
    > how can I format the criteria to evaluate a function for each cell?
    >
    >
    > --
    > QuantumPion
    > ------------------------------------------------------------------------
    > QuantumPion's Profile:

    http://www.excelforum.com/member.php...o&userid=23991
    > View this thread: http://www.excelforum.com/showthread...hreadid=376101
    >




  54. #54
    Harlan Grove
    Guest

    Re: need function to sum top ranking items in list

    QuantumPion wrote...
    >How can I make a function that will sum the largest 32 items in a column
    >which meet specific criteria? For example, the largest 32 values that
    >are smaller then X, or are not #N/A? I think I want to use SUMIF, but
    >how can I format the criteria to evaluate a function for each cell?


    SUMIF only provides one criterion. Use the array formula

    =SUM(LARGE(IF(ISNUMBER(List),IF(List<X,List)),ROW(INDIRECT("1:32"))))


  55. #55
    JE McGimpsey
    Guest

    Re: need function to sum top ranking items in list

    One way (array-entered: CTRL-SHIFT-ENTER or CMD-RETURN):

    =SUM(LARGE(IF(IF(ISNUMBER(rng),rng)<X,IF(ISNUMBER(rng),rng,0)),
    ROW(INDIRECT("1:32"))))

    In article <[email protected]>,
    QuantumPion <[email protected]>
    wrote:

    > How can I make a function that will sum the largest 32 items in a column
    > which meet specific criteria? For example, the largest 32 values that
    > are smaller then X, or are not #N/A? I think I want to use SUMIF, but
    > how can I format the criteria to evaluate a function for each cell?


  56. #56
    JE McGimpsey
    Guest

    Re: need function to sum top ranking items in list

    Actually I did, but I can't replicate it - must have been the same
    problem that caused me to add the extra if() in my formula.

    Sorry!

    In article <[email protected]>,
    "Harlan Grove" <[email protected]> wrote:

    > Did you test that assertion? Apparently not.
    >


  57. #57
    JE McGimpsey
    Guest

    Re: need function to sum top ranking items in list

    True. Thanks for the correction!

    In article <[email protected]>,
    "Harlan Grove" <[email protected]> wrote:

    > IF X is a number, the 3rd IF call, IF(ISNUMBER(rng),rng,0), is
    > unnecessary and should be replaced with just rng. Note that this relies
    > on the obscure fact that FALSE evaluates greater than any number value.


  58. #58
    Harlan Grove
    Guest

    Re: need function to sum top ranking items in list

    JE McGimpsey wrote...
    >One way (array-entered: CTRL-SHIFT-ENTER or CMD-RETURN):
    >
    >=SUM(LARGE(IF(IF(ISNUMBER(rng),rng)<X,IF(ISNUMBER(rng),rng,0)),
    >ROW(INDIRECT("1:32"))))

    ....

    IF X is a number, the 3rd IF call, IF(ISNUMBER(rng),rng,0), is
    unnecessary and should be replaced with just rng. Note that this relies
    on the obscure fact that FALSE evaluates greater than any number value.


  59. #59
    Harlan Grove
    Guest

    Re: need function to sum top ranking items in list

    JE McGimpsey wrote...
    >"Harlan Grove" <[email protected]> wrote:

    ....
    >>SUMIF only provides one criterion. Use the array formula
    >>
    >>=SUM(LARGE(IF(ISNUMBER(List),IF(List<X,List)),ROW(INDIRECT("1:32"))))

    >
    >Note that returns #N/A if the List contains #N/A...


    Did you test that assertion? Apparently not.

    Note that I use *2* *nested* IF calls. The first in effect passes only
    numbers on to the second. Any #N/A in List (or any other error values,
    text or boolean values) will produce a FALSE value in the result array
    from the outer IF call.

    A simplified example, if A1:A6 contained

    1
    #N/A
    3
    4
    5
    6

    and B1 contained the *ARRAY* formula

    =SUM(LARGE(IF(ISNUMBER(A1:A6),IF(A1:A6<5,A1:A6)),ROW(INDIRECT("1:2"))))

    the formula would return 7, not #N/A, because the formula would
    evaluate as

    =SUM(LARGE(IF(ISNUMBER({1;#N/A;3;4;5;6}),
    IF({1;#N/A;3;4;5;6}<5,{1;#N/A;3;4;5;6})),{1;2}))

    =SUM(LARGE(IF({TRUE;FALSE;TRUE;TRUE;TRUE;TRUE},
    IF({TRUE;#N/A;TRUE;TRUE;FALSE;FALSE},{1;#N/A;3;4;5;6})),{1;2}))

    =SUM(LARGE(IF({TRUE;FALSE;TRUE;TRUE;TRUE;TRUE},
    {1;#N/A;3;4;FALSE;FALSE}),{1;2}))

    =SUM(LARGE({1;FALSE;3;4;FALSE;FALSE},{1;2}))

    =SUM({4;3})

    =7


  60. #60
    JE McGimpsey
    Guest

    Re: need function to sum top ranking items in list

    In article <[email protected]>,
    "Harlan Grove" <[email protected]> wrote:

    > QuantumPion wrote...
    > >How can I make a function that will sum the largest 32 items in a column
    > >which meet specific criteria? For example, the largest 32 values that
    > >are smaller then X, or are not #N/A? I think I want to use SUMIF, but
    > >how can I format the criteria to evaluate a function for each cell?

    >
    > SUMIF only provides one criterion. Use the array formula
    >
    > =SUM(LARGE(IF(ISNUMBER(List),IF(List<X,List)),ROW(INDIRECT("1:32"))))


    Note that returns #N/A if the List contains #N/A...

  61. #61
    JE McGimpsey
    Guest

    Re: need function to sum top ranking items in list

    That fails under the OP's "not #N/A" criterion.

    In article <[email protected]>,
    "Bob Phillips" <[email protected]> wrote:

    > Here is an example that sums the top 32 that are not equal to 35
    >
    > =SUMPRODUCT(--(LARGE(IF(A1:A40<>35,A1:A40),ROW(INDIRECT("1:32")))))
    >
    > it is an array formula, so commit with Ctrl-Shift-Enter
    >
    > --
    > HTH
    >
    > Bob Phillips
    >
    > "QuantumPion" <[email protected]>
    > wrote in message
    > news:[email protected]...
    > >
    > > How can I make a function that will sum the largest 32 items in a column
    > > which meet specific criteria? For example, the largest 32 values that
    > > are smaller then X, or are not #N/A? I think I want to use SUMIF, but
    > > how can I format the criteria to evaluate a function for each cell?


  62. #62
    Harlan Grove
    Guest

    Re: need function to sum top ranking items in list

    Bob Phillips wrote...
    >Here is an example that sums the top 32 that are not equal to 35
    >
    >=SUMPRODUCT(--(LARGE(IF(A1:A40<>35,A1:A40),ROW(INDIRECT("1:32")))))
    >
    >it is an array formula, so commit with Ctrl-Shift-Enter

    ....

    If it has to be an array formula, no point using SUMPRODUCT rather than
    SUM. Also, LARGE only returns numbers, so no need for the '--' or the
    parentheses enclosing the LARGE call.

    =SUM(LARGE(IF(A1:A40<>35,A1:A40),ROW(INDIRECT("1:32"))))


  63. #63
    Bob Phillips
    Guest

    Re: need function to sum top ranking items in list

    Here is an example that sums the top 32 that are not equal to 35

    =SUMPRODUCT(--(LARGE(IF(A1:A40<>35,A1:A40),ROW(INDIRECT("1:32")))))

    it is an array formula, so commit with Ctrl-Shift-Enter

    --
    HTH

    Bob Phillips

    "QuantumPion" <[email protected]>
    wrote in message
    news:[email protected]...
    >
    > How can I make a function that will sum the largest 32 items in a column
    > which meet specific criteria? For example, the largest 32 values that
    > are smaller then X, or are not #N/A? I think I want to use SUMIF, but
    > how can I format the criteria to evaluate a function for each cell?
    >
    >
    > --
    > QuantumPion
    > ------------------------------------------------------------------------
    > QuantumPion's Profile:

    http://www.excelforum.com/member.php...o&userid=23991
    > View this thread: http://www.excelforum.com/showthread...hreadid=376101
    >




  64. #64
    Harlan Grove
    Guest

    Re: need function to sum top ranking items in list

    QuantumPion wrote...
    >How can I make a function that will sum the largest 32 items in a column
    >which meet specific criteria? For example, the largest 32 values that
    >are smaller then X, or are not #N/A? I think I want to use SUMIF, but
    >how can I format the criteria to evaluate a function for each cell?


    SUMIF only provides one criterion. Use the array formula

    =SUM(LARGE(IF(ISNUMBER(List),IF(List<X,List)),ROW(INDIRECT("1:32"))))


  65. #65
    Harlan Grove
    Guest

    Re: need function to sum top ranking items in list

    QuantumPion wrote...
    >How can I make a function that will sum the largest 32 items in a column
    >which meet specific criteria? For example, the largest 32 values that
    >are smaller then X, or are not #N/A? I think I want to use SUMIF, but
    >how can I format the criteria to evaluate a function for each cell?


    SUMIF only provides one criterion. Use the array formula

    =SUM(LARGE(IF(ISNUMBER(List),IF(List<X,List)),ROW(INDIRECT("1:32"))))


  66. #66
    Bob Phillips
    Guest

    Re: need function to sum top ranking items in list

    Here is an example that sums the top 32 that are not equal to 35

    =SUMPRODUCT(--(LARGE(IF(A1:A40<>35,A1:A40),ROW(INDIRECT("1:32")))))

    it is an array formula, so commit with Ctrl-Shift-Enter

    --
    HTH

    Bob Phillips

    "QuantumPion" <[email protected]>
    wrote in message
    news:[email protected]...
    >
    > How can I make a function that will sum the largest 32 items in a column
    > which meet specific criteria? For example, the largest 32 values that
    > are smaller then X, or are not #N/A? I think I want to use SUMIF, but
    > how can I format the criteria to evaluate a function for each cell?
    >
    >
    > --
    > QuantumPion
    > ------------------------------------------------------------------------
    > QuantumPion's Profile:

    http://www.excelforum.com/member.php...o&userid=23991
    > View this thread: http://www.excelforum.com/showthread...hreadid=376101
    >




  67. #67
    JE McGimpsey
    Guest

    Re: need function to sum top ranking items in list

    One way (array-entered: CTRL-SHIFT-ENTER or CMD-RETURN):

    =SUM(LARGE(IF(IF(ISNUMBER(rng),rng)<X,IF(ISNUMBER(rng),rng,0)),
    ROW(INDIRECT("1:32"))))

    In article <[email protected]>,
    QuantumPion <[email protected]>
    wrote:

    > How can I make a function that will sum the largest 32 items in a column
    > which meet specific criteria? For example, the largest 32 values that
    > are smaller then X, or are not #N/A? I think I want to use SUMIF, but
    > how can I format the criteria to evaluate a function for each cell?


  68. #68
    Harlan Grove
    Guest

    Re: need function to sum top ranking items in list

    Bob Phillips wrote...
    >Here is an example that sums the top 32 that are not equal to 35
    >
    >=SUMPRODUCT(--(LARGE(IF(A1:A40<>35,A1:A40),ROW(INDIRECT("1:32")))))
    >
    >it is an array formula, so commit with Ctrl-Shift-Enter

    ....

    If it has to be an array formula, no point using SUMPRODUCT rather than
    SUM. Also, LARGE only returns numbers, so no need for the '--' or the
    parentheses enclosing the LARGE call.

    =SUM(LARGE(IF(A1:A40<>35,A1:A40),ROW(INDIRECT("1:32"))))


  69. #69
    JE McGimpsey
    Guest

    Re: need function to sum top ranking items in list

    That fails under the OP's "not #N/A" criterion.

    In article <[email protected]>,
    "Bob Phillips" <[email protected]> wrote:

    > Here is an example that sums the top 32 that are not equal to 35
    >
    > =SUMPRODUCT(--(LARGE(IF(A1:A40<>35,A1:A40),ROW(INDIRECT("1:32")))))
    >
    > it is an array formula, so commit with Ctrl-Shift-Enter
    >
    > --
    > HTH
    >
    > Bob Phillips
    >
    > "QuantumPion" <[email protected]>
    > wrote in message
    > news:[email protected]...
    > >
    > > How can I make a function that will sum the largest 32 items in a column
    > > which meet specific criteria? For example, the largest 32 values that
    > > are smaller then X, or are not #N/A? I think I want to use SUMIF, but
    > > how can I format the criteria to evaluate a function for each cell?


  70. #70
    JE McGimpsey
    Guest

    Re: need function to sum top ranking items in list

    In article <[email protected]>,
    "Harlan Grove" <[email protected]> wrote:

    > QuantumPion wrote...
    > >How can I make a function that will sum the largest 32 items in a column
    > >which meet specific criteria? For example, the largest 32 values that
    > >are smaller then X, or are not #N/A? I think I want to use SUMIF, but
    > >how can I format the criteria to evaluate a function for each cell?

    >
    > SUMIF only provides one criterion. Use the array formula
    >
    > =SUM(LARGE(IF(ISNUMBER(List),IF(List<X,List)),ROW(INDIRECT("1:32"))))


    Note that returns #N/A if the List contains #N/A...

  71. #71
    Harlan Grove
    Guest

    Re: need function to sum top ranking items in list

    JE McGimpsey wrote...
    >"Harlan Grove" <[email protected]> wrote:

    ....
    >>SUMIF only provides one criterion. Use the array formula
    >>
    >>=SUM(LARGE(IF(ISNUMBER(List),IF(List<X,List)),ROW(INDIRECT("1:32"))))

    >
    >Note that returns #N/A if the List contains #N/A...


    Did you test that assertion? Apparently not.

    Note that I use *2* *nested* IF calls. The first in effect passes only
    numbers on to the second. Any #N/A in List (or any other error values,
    text or boolean values) will produce a FALSE value in the result array
    from the outer IF call.

    A simplified example, if A1:A6 contained

    1
    #N/A
    3
    4
    5
    6

    and B1 contained the *ARRAY* formula

    =SUM(LARGE(IF(ISNUMBER(A1:A6),IF(A1:A6<5,A1:A6)),ROW(INDIRECT("1:2"))))

    the formula would return 7, not #N/A, because the formula would
    evaluate as

    =SUM(LARGE(IF(ISNUMBER({1;#N/A;3;4;5;6}),
    IF({1;#N/A;3;4;5;6}<5,{1;#N/A;3;4;5;6})),{1;2}))

    =SUM(LARGE(IF({TRUE;FALSE;TRUE;TRUE;TRUE;TRUE},
    IF({TRUE;#N/A;TRUE;TRUE;FALSE;FALSE},{1;#N/A;3;4;5;6})),{1;2}))

    =SUM(LARGE(IF({TRUE;FALSE;TRUE;TRUE;TRUE;TRUE},
    {1;#N/A;3;4;FALSE;FALSE}),{1;2}))

    =SUM(LARGE({1;FALSE;3;4;FALSE;FALSE},{1;2}))

    =SUM({4;3})

    =7


  72. #72
    Harlan Grove
    Guest

    Re: need function to sum top ranking items in list

    JE McGimpsey wrote...
    >One way (array-entered: CTRL-SHIFT-ENTER or CMD-RETURN):
    >
    >=SUM(LARGE(IF(IF(ISNUMBER(rng),rng)<X,IF(ISNUMBER(rng),rng,0)),
    >ROW(INDIRECT("1:32"))))

    ....

    IF X is a number, the 3rd IF call, IF(ISNUMBER(rng),rng,0), is
    unnecessary and should be replaced with just rng. Note that this relies
    on the obscure fact that FALSE evaluates greater than any number value.


  73. #73
    JE McGimpsey
    Guest

    Re: need function to sum top ranking items in list

    True. Thanks for the correction!

    In article <[email protected]>,
    "Harlan Grove" <[email protected]> wrote:

    > IF X is a number, the 3rd IF call, IF(ISNUMBER(rng),rng,0), is
    > unnecessary and should be replaced with just rng. Note that this relies
    > on the obscure fact that FALSE evaluates greater than any number value.


  74. #74
    JE McGimpsey
    Guest

    Re: need function to sum top ranking items in list

    Actually I did, but I can't replicate it - must have been the same
    problem that caused me to add the extra if() in my formula.

    Sorry!

    In article <[email protected]>,
    "Harlan Grove" <[email protected]> wrote:

    > Did you test that assertion? Apparently not.
    >


+ 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