+ Reply to Thread
Results 1 to 11 of 11

Top/Bottom Rule for Conditional formatting

  1. #1
    Registered User
    Join Date
    10-13-2013
    Location
    TX
    MS-Off Ver
    Excel 2003
    Posts
    11

    Top/Bottom Rule for Conditional formatting

    Is there a way to use the Top/Bottom Rule to format the background colors on a range of cells where the number of cells that are formatted is based on a value in another cell?

  2. #2
    Registered User
    Join Date
    10-13-2013
    Location
    TX
    MS-Off Ver
    Excel 2003
    Posts
    11

    Re: Top/Bottom Rule for Conditional formatting

    OTexample.xlsx
    Here's a simple example of what I'm trying to do. Based on the "Number Needed" in cell F1, the lowest n values from column C (In my example, 2) should be conditionally formatted based on whether or not they have an x in the "Signed Up?" column B.

  3. #3
    Forum Expert ben_hensel's Avatar
    Join Date
    01-26-2012
    Location
    Northeast USA
    MS-Off Ver
    Office 365
    Posts
    2,043

    Re: Top/Bottom Rule for Conditional formatting

    I couldn't figure out a way to do it inside the rule itself, but it was simple with the addition of a dummy column in D to increment how many people were signed up, plus two more cells to keep track of relational data. Then it's a dead simple formula rule for conditional highlight.

    Anything you don't want to be visible in the final sheet can just be hidden, obviously.
    Attached Files Attached Files

  4. #4
    Registered User
    Join Date
    10-13-2013
    Location
    TX
    MS-Off Ver
    Excel 2003
    Posts
    11

    Re: Top/Bottom Rule for Conditional formatting

    This doesn't take into account how many hours each person has in column C. The sheet should highlight the 2 people with the lowest hours from that column.

  5. #5
    Forum Guru Jonmo1's Avatar
    Join Date
    03-08-2013
    Location
    Bryan, TX
    MS-Off Ver
    Excel 2010
    Posts
    9,763

    Re: Top/Bottom Rule for Conditional formatting

    Try

    =C2<=SMALL(IF($B$2:$B$6="x",$C$2:$C$6),$F$1)

    EFthequebs.xlsx

  6. #6
    Registered User
    Join Date
    10-13-2013
    Location
    TX
    MS-Off Ver
    Excel 2003
    Posts
    11

    Re: Top/Bottom Rule for Conditional formatting

    I guess I'm not explaining what I need very well. I want the 2 (from F1) people with the lowest hours (from column C) who signed up (from column B) for overtime to be highlighted. So.... They have to have an X next to their name in column B AND have the lowest hours in column C. In my original example sheet it is highlighted how it SHOULD look if it were working the way I need it to.

  7. #7
    Forum Guru Jonmo1's Avatar
    Join Date
    03-08-2013
    Location
    Bryan, TX
    MS-Off Ver
    Excel 2010
    Posts
    9,763

    Re: Top/Bottom Rule for Conditional formatting

    Umm, the book I posted is using conditional formatting to highlight the same 2 rows that your book highlighted manually.

  8. #8
    Registered User
    Join Date
    10-13-2013
    Location
    TX
    MS-Off Ver
    Excel 2003
    Posts
    11

    Re: Top/Bottom Rule for Conditional formatting

    In your book, change the "number needed" in F2 and watch what happens. change it to anything from 1 to 5.

    Or, move one of the X's from column B. It doesn't highlight the right rows.

  9. #9
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,939

    Re: Top/Bottom Rule for Conditional formatting

    1. highlight the range you want to apply the conditional formatting to
    2. on the home tab, styles, select CF
    3. select new rule, select use formula
    4. enter =$C2<=SMALL($C$2:$C$6,$F$1)

    edit: did not take X into account...
    =AND($C2<=SMALL($C$2:$C$6,$F$1),$B2="X")
    Last edited by FDibbins; 01-28-2014 at 03:34 PM.
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

  10. #10
    Forum Guru Jonmo1's Avatar
    Join Date
    03-08-2013
    Location
    Bryan, TX
    MS-Off Ver
    Excel 2010
    Posts
    9,763

    Re: Top/Bottom Rule for Conditional formatting

    OK, got it..

    Try

    =AND($B2="x",$C2<=SMALL(IF($B$2:$B$6="x",$C$2:$C$6),$F$1))

  11. #11
    Registered User
    Join Date
    10-13-2013
    Location
    TX
    MS-Off Ver
    Excel 2003
    Posts
    11

    Re: Top/Bottom Rule for Conditional formatting

    Quote Originally Posted by Jonmo1 View Post
    OK, got it..

    Try

    =AND($B2="x",$C2<=SMALL(IF($B$2:$B$6="x",$C$2:$C$6),$F$1))
    Alright! This one worked like a charm! Now if I can bother you for one more thing... If only one person is "signed up" with an X in column B and the "number needed" in F2 is higher than that I'd like for it to go ahead and format the lowest hours person that isn't X'd in column B. Does that make sense? And is it do-able?

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Toggle one conditional formatting rule on off using VB
    By lukestkd in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-26-2013, 10:56 AM
  2. [SOLVED] conditional formatting new rule formula
    By wannabe_guru in forum Excel General
    Replies: 4
    Last Post: 05-01-2012, 11:56 AM
  3. Conditional formatting rule need help
    By Kagesen in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-25-2011, 04:42 AM
  4. Replies: 1
    Last Post: 07-29-2010, 11:26 AM
  5. Excel 2007 : Conditional Formatting Percent rule
    By Ichigo in forum Excel General
    Replies: 1
    Last Post: 04-25-2009, 12:50 AM

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