+ Reply to Thread
Results 1 to 13 of 13

Highlight second highest values, problem with ties

  1. #1
    Registered User
    Join Date
    06-06-2012
    Location
    Antwerp, Belgium
    MS-Off Ver
    Excel 2010
    Posts
    7

    Highlight second highest values, problem with ties

    Hello everyone!

    I've set up a competition with friends. The goal is to predict football scores. A point is given for every correct score. A part of the prizemoney is for the one with the most points and another (smaller) part for the second-highest amount of points. If there are persons with the same (highest or second-highest) points, the respective part is divided among them.

    I want to highlight the persons who are in first (GREEN) and second (YELLOW) position (two different colors) with conditional formatting (for the first position I use =B7=MAX(B$7:B$21) formula in conditional formatting, no problem). How can I highlight the persons in second position? I tried with =B7=LARGE(B$7:B$21;2). This works, but only when the highest value is unique. If for example 2 persons have the same highest points (both 8 correct scores for example) (there is a tie), they are both highlighted as 'second place'. Can someone find a solution when a tie occurs?

    How it should look like: (example):
    Tim 8 (highlight) GREEN
    Rick 6 YELLOW
    Chris 8 GREEN
    Pete 6 YELLOW
    Dimi 4 no highlight


    Thanks in advance! I would be very happy if someone can solve this
    The excel (2010) file is attached. Sorry for the dutch version :s

    grtz
    Attached Files Attached Files

  2. #2
    Valued Forum Contributor
    Join Date
    05-07-2012
    Location
    USA
    MS-Off Ver
    Excel 2007
    Posts
    354

    Re: Highlight second highest values, problem with ties

    =B7=LARGE($B$7:$B$21,(COUNTIF($B$7:$B$21,MAX($B$7:$B$21))+1))

    for the second highest
    Regards,
    Vandan

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

    Re: Highlight second highest values, problem with ties

    I was just about to post the same thing (but without the extra bracket at the end )

    =B7=LARGE(B$7:B$21,COUNTIF($B$7:$B$21,MAX($B$7:$B$21))+1)

  4. #4
    Registered User
    Join Date
    06-06-2012
    Location
    Antwerp, Belgium
    MS-Off Ver
    Excel 2010
    Posts
    7

    Re: Highlight second highest values, problem with ties

    Mission accomplished Thank you vandan_tanna and Cutter for your quick response and effective solution! Congratz to excelforum and its members!
    grtz

  5. #5
    Registered User
    Join Date
    06-06-2012
    Location
    Antwerp, Belgium
    MS-Off Ver
    Excel 2010
    Posts
    7

    Re: Highlight second highest values, problem with ties

    Going further exploring the possibilities of excel, I was wondering if you can figure out this more complex option:
    in combination of your solution mentioned above, following handlings would improve the spreadsheet:

    Instead of just filling in 1 for a correct score and 0 for a wrong score manually in the 'field' C6:Z21, I would like to insert (before the start of the competition) all estimated scores of the participants in this field. As the competition goes on, I will fill in the correct scores in row 4 (C4:Z4). When the estimated score in the 'field' is correct, and in consequence identical to the respective score in row 4, this estimation should be highlighted. Consequently, column B (B4:B21) should sum up the correct (highlighted) scores. Finally, the same highlighting solution in column B from the initial thread above should be implemented (highlighting highest and second-highest scores, dealing with the tie-problem).

    I hope it doesn't appear too complex?

    I'm curious about discovering more on this subject, thanks in advance!
    grtz

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

    Re: Highlight second highest values, problem with ties

    That all sounds doable.

  7. #7
    Registered User
    Join Date
    06-06-2012
    Location
    Antwerp, Belgium
    MS-Off Ver
    Excel 2010
    Posts
    7

    Re: Highlight second highest values, problem with ties

    should I open a new thread on this topic?

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

    Re: Highlight second highest values, problem with ties

    It's so closely related, I would say no. But you should upload a new sample showing what you now want to do.

  9. #9
    Valued Forum Contributor
    Join Date
    05-07-2012
    Location
    USA
    MS-Off Ver
    Excel 2007
    Posts
    354

    Re: Highlight second highest values, problem with ties

    Assuming
    1. row 4 holds the victory margin (i.e. if Pol scored 2 and Gri scored 1 then C4 would be 1) (could be positive or negative number)
    2. C7:Z1 holds predictions (again same as above)

    then
    formula for B7: = sumproduct(--(C7:Z7-C4:Z4=0) )

  10. #10
    Registered User
    Join Date
    06-06-2012
    Location
    Antwerp, Belgium
    MS-Off Ver
    Excel 2010
    Posts
    7

    Re: Highlight second highest values, problem with ties

    in attachment a sample ('2nd plan')of how it should look like, to illustrate my last post
    Attached Files Attached Files

  11. #11
    Registered User
    Join Date
    06-06-2012
    Location
    Antwerp, Belgium
    MS-Off Ver
    Excel 2010
    Posts
    7

    Re: Highlight second highest values, problem with ties

    obviously the sample is an example for only 6 participants and 4 matches, just to clarify things

  12. #12
    Forum Expert daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    2016
    Posts
    14,675

    Re: Highlight second highest values, problem with ties

    Try this formula in B7 copied down

    = SUMPRODUCT((C7:Z7=C$4:Z$4)*(C$4:Z$4<>""))

    and you can conditionally format that column as suggested before

    For the other conditional formatting select the range C7@Z21 and use this formula

    =AND(C7=C$4,C$4<>"")

    format as required > OK
    Audere est facere

  13. #13
    Registered User
    Join Date
    06-06-2012
    Location
    Antwerp, Belgium
    MS-Off Ver
    Excel 2010
    Posts
    7

    Re: Highlight second highest values, problem with ties

    I inserted all your solutions in the spreadsheet, everything works! Thanks for your contribution and (very) quick responses
    grtz

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Tags for this Thread

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