+ Reply to Thread
Results 1 to 3 of 3

SUMIF and LARGE

  1. #1
    Registered User
    Join Date
    12-27-2011
    Location
    Oakland
    MS-Off Ver
    Excel 2010
    Posts
    2

    SUMIF and LARGE

    Hello,

    I would like to create a function similar to SUMIF(LARGE). Unfortunately large does not work within the sumif function. Can someone advise me how to select the 2 largest values meeting the criteria "A" and add them together? I have been able to come close with a pivot table but ultimately it does not work correctly when "A" has the same value multiple times in the table.

    A 1
    B 5
    C 3
    D 4
    E 9
    A 2
    B 3
    F 2
    G 5
    A 1
    B 6

    Any help is appreciated.

    Thanks!

  2. #2
    Forum Guru
    Join Date
    05-24-2011
    Location
    India
    MS-Off Ver
    365
    Posts
    2,243

    Re: SUMIF and LARGE

    Hello,

    How about tie values. in the example if you need answer 3; use this

    =SUM(IFERROR(LARGE(IF(A2:A12="A",B2:B12),{1,2}),0))

    If answer is 4; use this

    =SUM(SUMIFS(B2:B12,A2:A12,"A",B2:B12,IFERROR(LARGE(IF(A2:A12="A",B2:B12),{1,2}),9E300)))

    Both are confirmed with CTRL+SHIFT+ENTER
    Regards,
    Haseeb Avarakkan

    __________________________________
    "Feedback is the breakfast of champions"

  3. #3
    Registered User
    Join Date
    12-27-2011
    Location
    Oakland
    MS-Off Ver
    Excel 2010
    Posts
    2

    Re: SUMIF and LARGE

    The first one worked like a charm. Thanks!

+ 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