+ Reply to Thread
Results 1 to 6 of 6

Highlighting Rows below a Maximum Value

Hybrid View

  1. #1
    Registered User
    Join Date
    12-09-2011
    Location
    Prince George, Canada
    MS-Off Ver
    Excel 2010
    Posts
    4

    Highlighting Rows below a Maximum Value

    Hello all,

    I'm looking for assistance in the following problem, and would appreciate any and all suggestions/solutions. Thank you in advance!

    Here is the situation:

    1) I have dynamic data in two columns A & B, measuring 10 rows x 2 columns. (A1:A10 and B1:B10)

    2) I have a column of whole numbers in A1:A10, and have found the maximum value using =MAX(A1:A10).

    3) I would like to shade the two rows immediately below the maximum value: for example if the maximum was in cell A5, I would like A6:B6 and A7:B7 to be shaded.

    Does anyone have suggestions on how to accomplish this task? I suspect conditional formatting and perhaps the OFFSET function might be used, but I'm really not too skilled in this area.

    Much appreciated,
    csaunders86

  2. #2
    Registered User
    Join Date
    12-09-2011
    Location
    Prince George, Canada
    MS-Off Ver
    Excel 2010
    Posts
    4

    Re: Highlighting Rows below a Maximum Value

    Another way to think of this problem is the following word algorithm:

    IF (MAX of Column A = is above CURRENT cell by 1 OR 2 rows)

    THEN, SHADE CURRENT cell.

    ELSE DONT SHADE CURRENT cell
    .

  3. #3
    Forum Expert
    Join Date
    09-20-2011
    Location
    England
    MS-Off Ver
    Excel 2010
    Posts
    2,278

    Re: Highlighting Rows below a Maximum Value

    Hello
    You could try the following conditional formatting formula in cells A1:B10

    =OR(ROW()=MATCH(MAX($A$1:$A$10),$A$1:$A$10,0)+1,ROW()=MATCH(MAX($A$1:$A$10),$A$1:$A$10,0)+2)

    It seems to work for me.

    Hope this helps

  4. #4
    Forum Expert daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    Microsoft 365
    Posts
    14,719

    Re: Highlighting Rows below a Maximum Value

    So if A10 has the max value do you want A11:B12 formatted? What about duplicates, if the max value is repeated in A4 and A6 what should be formatted?
    Audere est facere

  5. #5
    Registered User
    Join Date
    12-09-2011
    Location
    Prince George, Canada
    MS-Off Ver
    Excel 2010
    Posts
    4

    Re: Highlighting Rows below a Maximum Value

    Thanks to DBY !! Exactly what I was hoping for - I didn't know about the MATCH() function. and daddylonglegs thanks too - you're right I will have to build in something that accommodates for duplicates, but I'm confident I can do that myself.
    Cheers and I've added to your reputation's.
    csaunders86

  6. #6
    Registered User
    Join Date
    12-09-2011
    Location
    Prince George, Canada
    MS-Off Ver
    Excel 2010
    Posts
    4

    Re: Highlighting Rows below a Maximum Value

    To forum admins...Please consider this thread SOLVED.

+ 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