+ Reply to Thread
Results 1 to 8 of 8

Conditionally Format duplicates in visible rows only

  1. #1
    Registered User
    Join Date
    02-10-2011
    Location
    Canada
    MS-Off Ver
    Excel 2019 / MS365
    Posts
    55

    Conditionally Format duplicates in visible rows only

    I have applied an advanced conditional format to a range of data, to highlight those cells which are duplicates. There are 3 sets of criteria, which are explained in the attached file, but in short, the following criteria must be met:
    1. The first cell in the column indicates whether it is critical for this column to identify duplicates
    2. The cells are non-blank. (If there are multiple cells that are blank in this column, I want them to be ignored).
    3. There are EXACT duplicates (case-sensitive) with this column.

    It works as expected until there is a filtered applied. I need the conditional formatting to be applied to duplicates in the VISIBLE cell only.

    The table regularly shrinks and grows, as new data is copied/pasted into this table. the conditional formatting must be dynamic, as it applies to different numbers of rows. I expect this will work smoothly, since it is contained in a table, which will auto-expand.

    Could someone provide assistance to this problem?
    Attached Files Attached Files
    Last edited by pinebush; 01-09-2017 at 09:38 AM.

  2. #2
    Forum Expert
    Join Date
    11-26-2013
    Location
    Colac, Victoria, Australia
    MS-Off Ver
    Excel 2016
    Posts
    1,309

    Re: Conditionally Format duplicates in visible rows only

    Hi pinebush.

    I added a helper column in Col E and in E3 entered =AGGREGATE(3,7,A3) and copied down. This simply sets a flag if the cell is visible.

    I then changed your CF to =AND(A$1="Critical",A3<>"",SUMPRODUCT(--EXACT(A$3:A$12,A3)*--($E$3:$E$12=1))>1)

    It seems to work!

    I hope this helps, please let me know!

    Regards,

    David


    - Please click on the *Add Reputation button at the bottom of helpful responses.

    Please mark your thread as SOLVED:
    - Click Thread Tools above your first post, select "Mark your thread as Solved".


  3. #3
    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: Conditionally Format duplicates in visible rows only

    If you only want to highlight the visible rows, whats the difference if some of the hidden rows are highlighted too? They wont be seen
    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

  4. #4
    Registered User
    Join Date
    02-10-2011
    Location
    Canada
    MS-Off Ver
    Excel 2019 / MS365
    Posts
    55

    Re: Conditionally Format duplicates in visible rows only

    David, that is a good start, and is helpful to see your revised CF formula. I guess I neglected to say that I need to have the same thing happen on all the columns. Therefore I was hoping to avoid a helper column, because my actual spreadsheet contains over 30 columns, which means that I will need the same number of helper columns. It seems to be overkill, but I have not been able to come up with a better solution on my own, so I have come to the forum for help.

  5. #5
    Registered User
    Join Date
    02-10-2011
    Location
    Canada
    MS-Off Ver
    Excel 2019 / MS365
    Posts
    55

    Re: Conditionally Format duplicates in visible rows only

    FDibbins,
    The problem is not that some of the hidden rows may be highlighted. Rather the problem is that it gives a false positive to the remaining visible value, because some of it's dups are hidden. I want only the visible ones to be considered for possible dups.

  6. #6
    Forum Expert
    Join Date
    11-26-2013
    Location
    Colac, Victoria, Australia
    MS-Off Ver
    Excel 2016
    Posts
    1,309

    Re: Conditionally Format duplicates in visible rows only

    You are not alone in wishing to avoid helper columns, but I use them all the time, because they make formulae less complex. It doesn't have to be in column e - you could have it in Col ZZ, or A or even on another sheet (and hide it). By the way, you only need one helper column. All it is doing is looking in column A to see if it is hidden or not. That's it! You don't need several columns as you assumed in your reply.

    Have a look at C1. If you change it to Critical, the CF kicks in, and the cells will be highlighted, but if you filter on Spring, as you suggested, the formatting is back to default. This will work the same for all 30 columns when the CF is applied to the whole range.

    I hope this helps, please let me know!

    Regards,

    David


    - Please click on the *Add Reputation button at the bottom of helpful responses.

    Please mark your thread as SOLVED:
    - Click Thread Tools above your first post, select "Mark your thread as Solved".

    Attached Files Attached Files

  7. #7
    Registered User
    Join Date
    02-10-2011
    Location
    Canada
    MS-Off Ver
    Excel 2019 / MS365
    Posts
    55

    Re: Conditionally Format duplicates in visible rows only

    David,
    I have incorporated your solution, and it works like a charm. I am not against using a helper column, but as you suggested, I assumed that I would need one for each table column.
    Thanks for your professionalism, and clear instructions. I also appreciate the absence of sarcasm when I did not thoroughly test before challenging your first response.

  8. #8
    Forum Expert
    Join Date
    11-26-2013
    Location
    Colac, Victoria, Australia
    MS-Off Ver
    Excel 2016
    Posts
    1,309

    Re: Conditionally Format duplicates in visible rows only

    You're welcome!

    Please remember to click on the Add Rep star (bottom left) and to mark the thread as solved.

    All the best, David

+ 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. Replies: 1
    Last Post: 01-04-2017, 06:00 PM
  2. Replies: 1
    Last Post: 01-04-2017, 05:59 PM
  3. [SOLVED] Conditionally format all rows until the last row.
    By themob212 in forum Excel General
    Replies: 3
    Last Post: 10-19-2016, 10:54 AM
  4. [SOLVED] conditionally format alternate rows every time the unique label changes In column B
    By jimcuk in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 06-15-2016, 08:42 AM
  5. Best Way to Conditionally Format Range (Multiple Columns and Rows)?
    By freybe06 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 11-14-2013, 04:53 PM
  6. Use visible rows from autofilter to build Pivot table. Or use visible rows to Copy/Paste
    By mwhitedesigns in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 08-08-2012, 10:34 AM
  7. format only visible (multiple) rows
    By lee_har in forum Excel General
    Replies: 6
    Last Post: 09-27-2009, 06:38 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