+ Reply to Thread
Results 1 to 16 of 16

Shade alternate filtered rows

  1. #1
    Registered User
    Join Date
    07-13-2016
    Location
    United States
    MS-Off Ver
    2016
    Posts
    7

    Shade alternate filtered rows

    I am trying to build a check register as a table (stretches from columns A to G) that will have alternate row shading with or without a filter and that will automatically keep the alternate row shading as rows for new transactions get added. I have tried this CF formula
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    which resulted in ALL rows changing to the format color I had selected and not even keeping the cell borders. Screenshot_Excel trouble.png

    I have also tried using a macro without having the check register as a table, just simple cells, and extending the range from A3:G530 and using the format painter to shade the rows how I wanted them. I used the macro to shade filtered cells on Sheets Jan - Dec. It works, but every time I close the spreadsheet and open it back up, I have to run the macro and select the cell range (A3:G530) for all 12 sheets. Is there a way for the macro to memorize the cell range? This is the code I used.

    Please Login or Register  to view this content.
    Please help! I'm not too proficient in Excel, so I have no idea what I'm doing wrong. Please be kind and VERY detailed in your response so I can understand exactly what to do. Thanks!

  2. #2
    Valued Forum Contributor
    Join Date
    01-08-2011
    Location
    Portsmouth, England
    MS-Off Ver
    Excel 2007 to 2016
    Posts
    456

    Re: Shade alternate filtered rows

    Hi and welcome to the forum.

    It's not clear from you picture if this is actually a "table".

    If it is, then you can just choose one of the automatic formats and it will colour the alternate lines for you, even if you filter.

    If it isn't already a table, select the first cell (Date in your example), then got to Insert and select Table. You will be asked to confirm the range and you should also check the box to say your table has headers. Once you've created the table, you will see a new tab on the ribbon for Table Tools. In the Table Styles, you can choose a format you like, including banded rows.

    Does that help?
    Excel is a constant learning process and it's great to help each other. If any of us have helped you today, a click on the "reputation" star on the left is appreciated.

  3. #3
    Forum Expert GeneralDisarray's Avatar
    Join Date
    09-15-2011
    Location
    Pittsburgh, PA, USA
    MS-Off Ver
    Windows Excel 2016
    Posts
    1,416

    Re: Shade alternate filtered rows

    Just make your table a 'table object' and Excel will handle that properly - you won't need any conditional formatting.
    Remember, saying thanks only takes a second or two. Click the star icon(*) below the post you liked, to give some Rep if you think an answer deserves it.

    Please,mark your thread [SOLVED] if you received your answer.

  4. #4
    Registered User
    Join Date
    07-13-2016
    Location
    United States
    MS-Off Ver
    2016
    Posts
    7

    Re: Shade alternate filtered rows

    Hi, shirleyxls...thanks for your response. It is already a table. I tried choosing one of the automatic formats and I didn't work. It wouldn't even give me a live preview. I made sure I had the correct selection of cells and that the "banded rows" box was checked on the Design tab.

    shirleyxls
    Re: Shade alternate filtered rows

    Hi and welcome to the forum.

    It's not clear from you picture if this is actually a "table".

    If it is, then you can just choose one of the automatic formats and it will colour the alternate lines for you, even if you filter.

    If it isn't already a table, select the first cell (Date in your example), then got to Insert and select Table. You will be asked to confirm the range and you should also check the box to say your table has headers. Once you've created the table, you will see a new tab on the ribbon for Table Tools. In the Table Styles, you can choose a format you like, including banded rows.

    Does that help?

  5. #5
    Registered User
    Join Date
    07-13-2016
    Location
    United States
    MS-Off Ver
    2016
    Posts
    7

    Re: Shade alternate filtered rows

    Thanks for your response, GeneralDisarray. How do I make my table a table object? When I google this, only references to creating a table show up.

    Re: Shade alternate filtered rows
    Just make your table a 'table object' and Excel will handle that properly - you won't need any conditional formatting.

  6. #6
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Shade alternate filtered rows

    Try this...

    Data Range
    A
    B
    C
    1
    Region
    Status
    Term
    2
    West
    No
    3
    3
    East
    No
    1
    4
    West
    Yes
    1
    5
    South
    No
    2
    6
    East
    No
    1
    7
    South
    No
    1
    8
    North
    Yes
    4
    9
    North
    No
    3
    10
    West
    No
    2


    Select the range A2:C10 starting from cell A2.

    Conditional formatting

    Formula: =MOD(SUBTOTAL(3,$A1:$A$2),2)=0

    Apply the desired fill color

    Now, if you filter Region on West you will get:

    Data Range
    A
    B
    C
    1
    Region
    Status
    Term
    2
    West
    No
    3
    4
    West
    Yes
    1
    10
    West
    No
    2
    Biff
    Microsoft MVP Excel
    Keep It Simple Stupid

    Let's Go Pens. We Want The Cup.

  7. #7
    Forum Expert GeneralDisarray's Avatar
    Join Date
    09-15-2011
    Location
    Pittsburgh, PA, USA
    MS-Off Ver
    Windows Excel 2016
    Posts
    1,416

    Re: Shade alternate filtered rows

    You could use Tony's solution, but for general reference, to make a table you just highlight the area you are working with, then press ctrl+T

    Check the box for 'headers' if you have them (otherwise it will make a generic header row for you).

  8. #8
    Registered User
    Join Date
    07-13-2016
    Location
    United States
    MS-Off Ver
    2016
    Posts
    7

    Re: Shade alternate filtered rows

    Tony, thanks for your response. I followed your suggestion and found that the shading works.
    Untitled picture.png

    However, if I input all the data and then realize that I forgot one and add it add the end (the 1/1/16 entry), my "Sort Oldest to Newest" looks like this:
    Untitled picture2.png

  9. #9
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Shade alternate filtered rows

    Many members are unable to see images in the *.png format due to forum compatibility issues with some browsers.

    If you need to post an image post it in the *.jpg format.

    Even better than posting images... post a SMALL sample file. That way we can test solutions directly in the file with the relevant data.

  10. #10
    Registered User
    Join Date
    07-13-2016
    Location
    United States
    MS-Off Ver
    2016
    Posts
    7

    Re: Shade alternate filtered rows

    Sorry, I didn't realize. Here's a small sample.
    Attached Files Attached Files

  11. #11
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Shade alternate filtered rows

    Your data starts in cell A3 so the corrected formula would be:

    =MOD(SUBTOTAL(3,$A2:$A$3),2)=0

    Works for me when I test it (add new dates to column A then sort).

  12. #12
    Registered User
    Join Date
    07-13-2016
    Location
    United States
    MS-Off Ver
    2016
    Posts
    7

    Re: Shade alternate filtered rows

    Thanks, Tony. Worked perfectly as long as I resort afterwards.

  13. #13
    Valued Forum Contributor
    Join Date
    01-08-2011
    Location
    Portsmouth, England
    MS-Off Ver
    Excel 2007 to 2016
    Posts
    456

    Re: Shade alternate filtered rows

    In case you still wanted to go down the table route (or just for future reference) I managed to make it into a table in your test file.

    I think the problem was that you had changed some of the formatting so that overrides whichever table style you choose. I selected the whole table, then on the Home tab, click on the "Clear" drop down (at the right hand end of the ribbon under Editing), then chose Clear Formats. This gets rid of all the formatting so you can then go back to the Table Tools and pick a style. You'd also have to reformat the dates and currency values but at least it solves the banding problem.

    I've attached an updated version just so you can see how it looks
    Attached Files Attached Files

  14. #14
    Registered User
    Join Date
    07-13-2016
    Location
    United States
    MS-Off Ver
    2016
    Posts
    7

    Re: Shade alternate filtered rows

    Thanks, shirleyxls!

  15. #15
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Shade alternate filtered rows

    You're welcome. Thanks for the feedback!

  16. #16
    Registered User
    Join Date
    08-03-2019
    Location
    Germany
    MS-Off Ver
    2019
    Posts
    6

    Re: Shade alternate filtered rows

    Hi all,

    Thank you for all the suggestions. I just dug this one up while searching for the correct formula and wanted to pay my respects.

    First of all, I am a big fan of tables and convert pretty much any collectoin of data in excel to a table... but on rare occasions a table is just not what you need (for example: if you need the headers to be dynamic using formulas) or my personal favorite: you have a table and you want to emphasize certain colunms but do not want to loose the dark/light color highlighting. This is where the Mod/Subtotal combination really comes in handy as the dark/light rows stay aligned with those of the table's own standard highlighting and stay aligned even if you have a filter applied.

    Capture.JPG
    Last edited by Opal_1970; 04-14-2020 at 04:19 AM.

+ 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. Shade Alternate Rows when Using Grouping
    By HangMan in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 06-05-2015, 12:01 PM
  2. Replies: 4
    Last Post: 08-16-2012, 06:20 PM
  3. [SOLVED] How to shade alternate Pairs of partial rows
    By jacob@thepenpoint in forum Excel General
    Replies: 3
    Last Post: 06-28-2012, 12:52 PM
  4. *Shade* alternating rows
    By BobJones in forum Excel General
    Replies: 9
    Last Post: 09-17-2011, 02:19 AM
  5. shade rows
    By Manohar in forum Excel General
    Replies: 2
    Last Post: 03-31-2005, 03:06 PM
  6. [SOLVED] shade rows
    By Manny in forum Excel General
    Replies: 2
    Last Post: 03-31-2005, 02:06 PM
  7. [SOLVED] Shade rows A:J
    By Elaine in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 02-22-2005, 10:06 AM

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