Results 1 to 3 of 3

Thread: Conditional Formatting Shading by Group When Filtered

  1. #1
    Junior Member
    Join Date
    Sep 2013
    Posts
    2
    Rep Power
    0

    Conditional Formatting Shading by Group When Filtered

    Hello,

    I am using Excel 2010 on XP. I would like to apply conditional formatting to shade every group in alternating color. For example, I have a list of US states. I have a formula already to produce this:

    Current Conditional Formatting Formula: =MOD(SUMPRODUCT(--($a$1:$a1<>$a$2:$a2)),2)

    STATES (unfiltered)

    AL
    AL

    AK
    AK
    AK

    AR
    AR

    AZ
    AZ
    AZ




    When I apply a filter, the rows remain shaded as they were originally:

    STATES (Filter OUT AK)

    AL
    AL

    AR
    AR

    AZ
    AZ
    AZ



    I want the conditional format to change when I have filtered out items (DESIRED RESULT):

    STATES (Filter OUT AK)

    AL
    AL

    AR
    AR

    AZ
    AZ
    AZ



    I would assume SUBTOTAL(3,...) would need to be incorported into the conditional formatting formula above, but I do not know how.

    Thanks for your help!
    Last edited by exs120; 09-20-2013 at 10:51 PM. Reason: SOLVED

  2. #2
    Administrator Admin's Avatar
    Join Date
    Mar 2011
    Posts
    1,123
    Rep Power
    10
    Hi

    Try

    =MOD(SUMPRODUCT(SUBTOTAL(3,OFFSET($A$2,ROW($A$2:$A 2)-ROW($A$2)+1,,1)),--($A$1:$A1<>$A$2:$A2)),2)
    Cheers !

    Excel Range to BBCode Table
    Use Social Networking Tools If You Like the Answers !

    Message to Cross Posters

    @ Home - Office 2010/2013/2016 on Win 10 (64 bit); @ Work - Office 2016 on Win 10 (64 bit)

  3. #3
    Junior Member
    Join Date
    Sep 2013
    Posts
    2
    Rep Power
    0
    It works without the +1 =MOD(SUMPRODUCT(SUBTOTAL(3,OFFSET($A$2,ROW($A$2:$A 2)-ROW($A$2),,1)),--($A$1:$A1<>$A$2:$A2)),2)

    Thanks for your help!

Similar Threads

  1. Get Displayed Cell Color (whether from Conditional Formatting or not)
    By Rick Rothstein in forum Rick Rothstein's Corner
    Replies: 14
    Last Post: 10-21-2013, 07:11 PM
  2. get conditional formatting color of a cell
    By SP69 in forum Excel Help
    Replies: 2
    Last Post: 09-30-2013, 03:08 PM
  3. Conditional formatting
    By mahmoud-lee in forum Excel Help
    Replies: 9
    Last Post: 05-30-2013, 03:00 PM
  4. Conditional Formatting using formula.
    By Ryan_Bernal in forum Excel Help
    Replies: 2
    Last Post: 02-18-2013, 11:33 PM
  5. Conditional Formatting - If/And Formula
    By Katrina in forum Excel Help
    Replies: 4
    Last Post: 11-23-2012, 12:45 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •