+ Reply to Thread
Results 1 to 8 of 8

highlight duplicates in one or more columns, only if the cell has a value inside (visible)

  1. #1
    Registered User
    Join Date
    05-29-2020
    Location
    Chisinau
    MS-Off Ver
    2019
    Posts
    39

    Question highlight duplicates in one or more columns, only if the cell has a value inside (visible)

    I have this code that works for the first part, I mean to highlight the duplicates in the column "B", for two different sheets, in an active worksheet. I have more than two worksheets, but I posted the code to look more simple.

    Please Login or Register  to view this content.
    And I wanted to make it work for two columns for each sheet. I don't know how to add for one more column (my other column is "F")... but I added in the code above an identical line as this:
    Please Login or Register  to view this content.
    So far so good... now the code finds the duplicate values in both columns, "B" and "F".
    My problem is that in the F column the values are the result of some formula. Sometimes the cells look empty (blank), but there is a formula there. The above code considers these apparently blank cells also duplicates and colors them. I need it to color the duplicates only if there is a visible value in those cells. I have seen on the net I should use the functions ISBLANK or ISEMPTY with true or false, to get the second condition fulfilled. But it is beyond my knowledge to write the new "if" function.

    Therefore... Please help me!

  2. #2
    Valued Forum Contributor
    Join Date
    04-01-2015
    Location
    The Netherlands
    MS-Off Ver
    2003/2007/2010/2016/office 365
    Posts
    880

    Re: highlight duplicates in one or more columns, only if the cell has a value inside (visi

    Why not with conditional formatting?

    Please Login or Register  to view this content.
    Last edited by Vraag en antwoord; 07-11-2020 at 09:41 AM.

  3. #3
    Registered User
    Join Date
    05-29-2020
    Location
    Chisinau
    MS-Off Ver
    2019
    Posts
    39

    Re: highlight duplicates in one or more columns, only if the cell has a value inside (visi

    I thought it would be easier to just add a condition inside the "if" function.

    I also changed what I wrote since I saw you added a VBA.
    Last edited by Alexander2020; 07-11-2020 at 09:46 AM.

  4. #4
    Valued Forum Contributor
    Join Date
    04-01-2015
    Location
    The Netherlands
    MS-Off Ver
    2003/2007/2010/2016/office 365
    Posts
    880

    Re: highlight duplicates in one or more columns, only if the cell has a value inside (visi

    I changed my message. See #2

  5. #5
    Registered User
    Join Date
    05-29-2020
    Location
    Chisinau
    MS-Off Ver
    2019
    Posts
    39

    Re: highlight duplicates in one or more columns, only if the cell has a value inside (visi

    OK... I'll try it... but can you make it work for two columns in each sheet? "B" and "F" columns?

  6. #6
    Valued Forum Contributor
    Join Date
    04-01-2015
    Location
    The Netherlands
    MS-Off Ver
    2003/2007/2010/2016/office 365
    Posts
    880

    Re: highlight duplicates in one or more columns, only if the cell has a value inside (visi

    That also happens. Try it

  7. #7
    Registered User
    Join Date
    05-29-2020
    Location
    Chisinau
    MS-Off Ver
    2019
    Posts
    39

    Re: highlight duplicates in one or more columns, only if the cell has a value inside (visi

    Thank you very much! It is working 100%. How did you tell to look in the "F" column? It must be this trick: cl.Offset(, 4)... the 4th column from "B" is "F".
    Anyway... You are a genius in VBA coding... You made it work so fast!

  8. #8
    Registered User
    Join Date
    05-29-2020
    Location
    Chisinau
    MS-Off Ver
    2019
    Posts
    39

    Re: highlight duplicates in one or more columns, only if the cell has a value inside (visi

    Offtopic, but somehow related to the solution I got in this thread... Is it possible to write in a shorter form?

    Application.Sum(Offset(, 1), Offset(, 2), Offset ( ,3), Offset (,4))
    Something like:
    Application.Sum(Offset(, 1): Offset (,4))
    or
    Application.Sum(Offset(, 1)- Offset (,4))

    I know the above is not working... but if I have 20 such consecutive Offset cells... ???

+ 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. [SOLVED] Highlight duplicates between 2 columns
    By dawondr in forum Excel General
    Replies: 3
    Last Post: 08-10-2018, 11:30 AM
  2. [SOLVED] Highlight duplicates in two columns by Conditional Formatting
    By Max_excel in forum Excel General
    Replies: 11
    Last Post: 04-17-2018, 04:46 AM
  3. Highlight duplicates, multiple columns
    By ChrisLN in forum Excel General
    Replies: 2
    Last Post: 11-04-2016, 05:57 AM
  4. [SOLVED] Highlight Duplicates Between Multiple Columns
    By WorkwearExp in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 06-10-2014, 08:12 AM
  5. How to compare two columns and highlight and rows containing duplicates
    By ks100 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 02-12-2014, 04:47 PM
  6. Highlight Duplicates from Two Columns with Different Colours
    By ddgacic in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 12-24-2012, 06:22 AM
  7. find duplicates in two columns and highlight whole row
    By stryker9603 in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 01-22-2010, 01:46 PM

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