+ Reply to Thread
Results 1 to 6 of 6

Finding largest combination of cell values

  1. #1
    Registered User
    Join Date
    11-07-2012
    Location
    United States
    MS-Off Ver
    Excel 2007
    Posts
    7

    Finding largest combination of cell values

    Hi all - I'm looking for an elegant way to calculate and highlight the largest combination of 5 cells. For example:

    Column A
    1
    2
    3
    1
    2
    3
    4
    1
    2
    3
    1
    2
    3

    I'd want the formula to show me that the five bolded numbers produce the greatest sum of any of the five numbers in the column. I'd also like to be able to highlight the cells.

    Does that make sense and is it doable within Excel 2007?

    Thanks, in advance, for your help!
    Last edited by omni72; 11-22-2012 at 04:20 PM.

  2. #2
    Forum Guru MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Woodinville, WA
    MS-Off Ver
    Office 365
    Posts
    16,167

    Re: Finding largest combination of cell values

    Hi omni72,

    How about a helper column that adds the numbers to the left down 5 rows. Then a Conditional Format on the helper to show the largest "Sum of 5"?
    Attached Files Attached Files
    One test is worth a thousand opinions.
    Click the * Add Reputation below to say thanks.

  3. #3
    Registered User
    Join Date
    11-07-2012
    Location
    United States
    MS-Off Ver
    Excel 2007
    Posts
    7

    Re: Finding largest combination of cell values

    Hi Marvin -

    Thanks for the quick reply and excellent suggestion. However, and my apologies for omitting this earlier, the combination doesn't necessarily need to be sequential. In other words, it could be A1, A4, A5, A13, & A16 or A2, A4, A9, A12, & A14. Does that make sense? If not let me know and I will try to elaborate.

    I've also attached an Excel 2007 spreadsheet as a sample. It's probably a bad example because in this case it is the first 5 cells :D
    Attached Files Attached Files

  4. #4
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    24,705

    Re: Finding largest combination of cell values

    Don't you just want the 5 largest numbers?

    Pete

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

    Re: Finding largest combination of cell values

    going on from petes thought
    to get the sum use
    =SUM(LARGE(E2:E21,{1,2,3,4,5}))
    then select e2
    open name manager and create a name
    call it say mylarge
    refers to
    =ISNUMBER(MATCH(Sheet1!E2,LARGE(Sheet1!$E$2:$E$22,{1,2,3,4,5}),0))
    now in e2 select conditional format and use a formula option
    put = mylarge chose a format
    copy that format to rest of range
    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

  6. #6
    Registered User
    Join Date
    11-07-2012
    Location
    United States
    MS-Off Ver
    Excel 2007
    Posts
    7

    Re: Finding largest combination of cell values

    Quote Originally Posted by martindwilson View Post
    going on from petes thought
    to get the sum use
    =SUM(LARGE(E2:E21,{1,2,3,4,5}))
    then select e2
    open name manager and create a name
    call it say mylarge
    refers to
    =ISNUMBER(MATCH(Sheet1!E2,LARGE(Sheet1!$E$2:$E$22,{1,2,3,4,5}),0))
    now in e2 select conditional format and use a formula option
    put = mylarge chose a format
    copy that format to rest of range
    Excellent idea, Martin! Thanks so much for the effort and elegance.

    And thanks to all who chimed in - the EF community is unquestionably the best!

+ 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