+ Reply to Thread
Results 1 to 4 of 4

Conditional formatting based on a row number

Hybrid View

  1. #1
    Registered User
    Join Date
    03-15-2012
    Location
    Perth, Australia
    MS-Off Ver
    Excel 2010
    Posts
    1

    Conditional formatting based on a row number

    I am developing a table to manage client sales and want to be able highlight the top 20% of clients in the table.

    I just need some help on the conditional formatting.

    I already have a cell which counts the numbers of rows that contain client data based on client name in column A. Currently this is 24
    I also have a cell which calculates 20% of this number of columns = 4.8 round up to 5

    I was told by a colleague to use the following formula in conditional formatting:

    =$A2=Row()<=$A$53+2

    Where A2 is the first cell in the Client Name column and A53 is the cells containing the calculation of 20% of total rows containing client data (e.g. 5)

    Based on this formula cells in column A corresponding to rows numbered less than or equal to 7 should be filled in red.

    I received no error message re my formula but the conditional formatting does not seem to work. I assume the formula is wrong.

    Could someone be kind enough to let me know how I should do this.

  2. #2
    Forum Expert DGagnon's Avatar
    Join Date
    02-23-2012
    Location
    Ontario, Canada
    MS-Off Ver
    Excel 2003, 2007
    Posts
    1,645

    Re: Conditional formatting based on a row number

    could you please share a sample of your workbook?
    If you liked my solution, please click on the Star -- to add to my reputation

    If your issue as been resolved, please clearly state so and mark the thread as [SOLVED] using the thread tools just above the first post.

  3. #3
    Registered User
    Join Date
    03-14-2012
    Location
    England
    MS-Off Ver
    Excel 2010
    Posts
    14

    Re: Conditional formatting based on a row number

    I think this is what you are looking for...

    Conditional Formatting range applies to $A$2:$A$1000 (change if you may have more than 998 records/rows)

    Formula for Conditional Formatting:
    =ROW(INDEX(A:A,ROW()))<$D$9+2
    Example: Row Number Based CF.xlsx
    Dim Prawny As Newb

  4. #4
    Forum Expert DGagnon's Avatar
    Join Date
    02-23-2012
    Location
    Ontario, Canada
    MS-Off Ver
    Excel 2003, 2007
    Posts
    1,645

    Re: Conditional formatting based on a row number

    your sample file appears to be working for me, if i change the value in Cell D9 the number of highlighted rows also changes.

    if you are getting errors, try this

    =ROW($A2)<$D$9+2

+ 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