+ Reply to Thread
Results 1 to 11 of 11

Copy conditional formatting rule ("mark duplicates") to other ranges

  1. #1
    Registered User
    Join Date
    12-30-2020
    Location
    Belgium
    MS-Off Ver
    MS Office 365
    Posts
    7

    Copy conditional formatting rule ("mark duplicates") to other ranges

    Hello,

    is it possible to copy a conditional format rule to another range, WITHOUT copying the base formatting of the cells?
    For example, I have a rule to mark duplicate values in range A1->A20, but I need the same rule in range C1->C20, and in >600 other columns. Can I copy the rule, without touching the base formatting?

    Thanks!

  2. #2
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,458

    Re: Copy conditional formatting rule ("mark duplicates") to other ranges

    Welcome to the forum.

    You can create a formula rule and apply it to multiple columns all at once.

    There are instructions at the top of the page explaining how to attach your sample workbook.
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    Forum Rules (updated August 2023): please read them here.

  3. #3
    Registered User
    Join Date
    12-30-2020
    Location
    Belgium
    MS-Off Ver
    MS Office 365
    Posts
    7

    Re: Copy conditional formatting rule ("mark duplicates") to other ranges

    Thanks for the (very) quick reply

    But it's not exactly what I want: I want to check duplicates in each column on it's own.

    I tried to attach a small example:

    In the first column, NO cell should be highlighted because there are no duplicates.
    In the second column, "SP" should be highlighted.
    Different columns should not be compared to each other.
    Attached Files Attached Files

  4. #4
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,368

    Re: Copy conditional formatting rule ("mark duplicates") to other ranges

    You might find that, if you apply Conditional Formatting to over 600 columns, the performance of your workbook could be impaired. Just a thought 💭. That would be compounded if you add and/or delete columns and/or rows.
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  5. #5
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,458

    Re: Copy conditional formatting rule ("mark duplicates") to other ranges

    But it's not exactly what I want: I want to check duplicates in each column on it's own.
    I know that. You are making an incorrect assumption. I'll have a look at your workbook.

  6. #6
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,458

    Re: Copy conditional formatting rule ("mark duplicates") to other ranges

    OK - what has possessed you to merge cells across columns??? You are making life difficult for yourself. Please get rid of those first.

    https://excel.solutions/2016/10/usin...ctively-excel/

  7. #7
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,458

    Re: Copy conditional formatting rule ("mark duplicates") to other ranges

    Rule for A1:

    =AND(A1<>"",COUNTIF(A:A,A1)>1)

    Applies to: =$A$1:$ZZ$10
    Attached Files Attached Files

  8. #8
    Registered User
    Join Date
    12-30-2020
    Location
    Belgium
    MS-Off Ver
    MS Office 365
    Posts
    7

    Re: Copy conditional formatting rule ("mark duplicates") to other ranges

    Oh waw I didn't know that!

    It's a legacy thing, changing this would mean tens of hours of work.
    I'll think about it though.

  9. #9
    Registered User
    Join Date
    12-30-2020
    Location
    Belgium
    MS-Off Ver
    MS Office 365
    Posts
    7

    Re: Copy conditional formatting rule ("mark duplicates") to other ranges

    Quote Originally Posted by AliGW View Post
    Rule for A1:

    =AND(A1<>"",COUNTIF(A:A,A1)>1)

    Applies to: =$A$1:$ZZ$10

    Amazing, it works perfectly!!!

    I don't quite understand the code you're using, but it works, thanks!!!

  10. #10
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,458

    Re: Copy conditional formatting rule ("mark duplicates") to other ranges

    It's checking that A1 is not blank (otherwise empty cells would be highlighted) and that there is more than one of A1 in that column. Because the references are not anchored, they are dynamic.

    If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED.

    Also, you may not be aware that you can thank those who have helped you by clicking the small star icon located in the lower left corner of the post in which the help was given. By doing so you can add to the reputation(s) of those who helped.

  11. #11
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,368

    Re: Copy conditional formatting rule ("mark duplicates") to other ranges

    When you apply a Conditional Formatting formula to a range, you MUST make it relate to the top left cell in the range. In this case, Ali has applied the formula to cells =$A$1:$ZZ$10 and the formula refers to cell A1 and column A. When you make the formula references relative (as opposed to absolute), they will automatically adjust in subsequent columns and rows. You won't see it but, effectively, the formula for column B becomes
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    and for column C it is
    Formula: copy to clipboard
    Please Login or Register  to view this content.

+ 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: 7
    Last Post: 10-21-2019, 03:34 PM
  2. [SOLVED] Help to check data with miltiple conditions then mark "YES" if meet else mark "NO"
    By sbv1986 in forum Excel Programming / VBA / Macros
    Replies: 13
    Last Post: 05-05-2019, 05:52 AM
  3. [SOLVED] Conditional Formatting - copy "new" only new cell colors to other columns
    By zookeepertx in forum Excel General
    Replies: 4
    Last Post: 05-11-2016, 04:44 PM
  4. Conditional Formatting "Apply rule to.." Option not there
    By sjocusato in forum Excel General
    Replies: 5
    Last Post: 11-24-2015, 02:51 PM
  5. Anyone know a way to "Copy/paste Values" for conditional formatting?
    By jlax34 in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 11-01-2012, 05:22 PM
  6. Replies: 2
    Last Post: 08-17-2012, 05:10 AM
  7. Conditional formatting using a rule "Contains"
    By alexlead in forum Excel General
    Replies: 4
    Last Post: 08-24-2011, 08:13 PM

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