+ Reply to Thread
Results 1 to 17 of 17

Find Duplicate Rows Where Two Columns Match

  1. #1
    Registered User
    Join Date
    05-01-2015
    Location
    United Kingdom
    MS-Off Ver
    Office 2013
    Posts
    12

    Find Duplicate Rows Where Two Columns Match

    Hi There,

    I'm trying to find and highlight duplicate rows of data where two columns contain the same information. My scenario is (Column1: Name) (Column2: Address). From these two columns I want to be able to run some code that will highlight all the rows where the 'Name' and 'Address' in one row match to another.
    So for example if I had the followign data:
    Row1: Joe Bloggs, The House
    Row2: Joe Bloggs, Flat 1
    Row3: Joe Bloggs, The House

    I would like it to highlight Row 1 and Row 3 please as both column 1 and 2 are a matching pair as opposed to Row 2 where only the name is the same. Currently I have the following code but it doesn't highlight just the matching pairs it would highlight in my previous example Row2 as well as the name matches that of Row1 and 3.

    Please Login or Register  to view this content.
    I would really appreciate some help on this please as my knowledge of excel is limited.

    Many thanks,

    Dom
    Last edited by MCCDOM; 11-27-2017 at 12:06 PM.

  2. #2
    Forum Guru Sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2019 | 2021
    Posts
    14,958

    Re: Find Duplicate Rows Where Two Columns Match

    Hi Dom

    Give this a try....
    Please Login or Register  to view this content.
    Good Luck...
    I don't presume to know what I am doing, however, just like you, I too started somewhere...
    One-day, One-problem at a time!!!
    If you feel I have helped, please click on the [★ Add Reputation] to left of post window...
    Also....Add a comment if you like!!!!
    And remember...Mark Thread as Solved...
    Excel Forum Rocks!!!

  3. #3
    Registered User
    Join Date
    05-01-2015
    Location
    United Kingdom
    MS-Off Ver
    Office 2013
    Posts
    12

    Re: Find Duplicate Rows Where Two Columns Match

    Hi Sintek

    That works perfectly, thank you so much. I do have one small problem however, I have tried applying it to my spreadsheet in the relevant columns (D & E) and it doesn't seem to work. I've replaced all "A's" with "D" and all "B's" with "E" in your code. After debugging it gets to the 'For i = 2 to 1Row' line of code and then skips to the 'End With' line of code. I'm sure this is a really simple fix but it has got me stumped. Would you be able to help me out please? Also is there a way to get it to check across 4 different sheets (including this one) for duplicates please?

    Many thanks

    Dom

  4. #4
    Forum Guru Sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2019 | 2021
    Posts
    14,958

    Re: Find Duplicate Rows Where Two Columns Match

    Hi Dom

    I cannot recreate as I do not have a sample of your workbook to test....
    I think it might be that you did not change the Field no's ....
    Please Login or Register  to view this content.
    i.e. A is field 1 so D should become Field 4 and E Field 5
    Yes, we can add a loop to go through all the sheets...
    To attach a file, click on Go Advanced (below the Edit Window) while you are composing a reply, then scroll down to and click on Manage Attachments and the Upload window will open. Click on Browse and navigate to (and double-click) the file icon that you want to attach, then click on Upload and then on Close this Window to return to the Edit window. When you have finished composing your post, click on Submit Post.
    Last edited by Sintek; 11-29-2017 at 08:39 AM.

  5. #5
    Registered User
    Join Date
    05-01-2015
    Location
    United Kingdom
    MS-Off Ver
    Office 2013
    Posts
    12

    Re: Find Duplicate Rows Where Two Columns Match

    Hi Sintek

    I have attached a copy of my workbook for you.

    I've only changed letters. No numbers. Am I supposed to change the number of the field please?

    Really appreciate your help on this.

    Many thanks,

    Dom
    Attached Files Attached Files

  6. #6
    Forum Guru Sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2019 | 2021
    Posts
    14,958

    Re: Find Duplicate Rows Where Two Columns Match

    ...No duplicates in the individual sheets.....

    Please Login or Register  to view this content.
    Last edited by Sintek; 11-29-2017 at 09:27 AM.

  7. #7
    Registered User
    Join Date
    05-01-2015
    Location
    United Kingdom
    MS-Off Ver
    Office 2013
    Posts
    12

    Re: Find Duplicate Rows Where Two Columns Match

    Yes sorry Sintek, you're quite right. I had got ahead of myself there. What I would like to be able to do is check for duplicates not only in the individual sheet but also if there are any duplicates across the entire workbook.
    I've attached the workbook again but this time there is now a duplicate on the individual sheet of sheet1 as well as the original duplicates across all the sheets.

    Sorry for any confusion.

    Many thanks

    Dom
    Attached Files Attached Files

  8. #8
    Forum Guru Sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2019 | 2021
    Posts
    14,958

    Re: Find Duplicate Rows Where Two Columns Match

    In future, please please request the exact requirement from start as this will ensure that no time gets wasted on code that does not match the request.

  9. #9
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,834

    Re: Find Duplicate Rows Where Two Columns Match

    See if this is how you wanted.
    Please Login or Register  to view this content.

  10. #10
    Forum Guru Sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2019 | 2021
    Posts
    14,958

    Re: Find Duplicate Rows Where Two Columns Match

    Nice one jindon

    Nope edit not working....I thik OP wants all duplicates on sheets to be highlighted...
    Last edited by Sintek; 11-29-2017 at 09:50 AM. Reason: Incorrect code edit

  11. #11
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,834

    Re: Find Duplicate Rows Where Two Columns Match

    Quote Originally Posted by MCCDOM View Post
    I'm trying to find and highlight duplicate rows of data where two columns contain the same information. My scenario is (Column1: Name) (Column2: Address). From these two columns I want to be able to run some code that will highlight all the rows where the 'Name' and 'Address' in one row match to
    Try
    Please Login or Register  to view this content.
    Last edited by jindon; 11-29-2017 at 10:11 AM.

  12. #12
    Registered User
    Join Date
    05-01-2015
    Location
    United Kingdom
    MS-Off Ver
    Office 2013
    Posts
    12

    Re: Find Duplicate Rows Where Two Columns Match

    Thank you both, and sorry again Sintek. That code has both worked and not worked. First off it has highlighted the duplicates but on some sheets, it has highlighted the duplicate name on one sheet but has not highlighted the duplicate on the other sheet. It has also highlighted a name that is not a duplicate (Adam Baldwin, 1 The Street) on sheet1.

    I've attached the results.

    Thanks again for all your help.

    Dom
    Attached Files Attached Files

  13. #13
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,834

    Re: Find Duplicate Rows Where Two Columns Match

    .....................
    Attached Files Attached Files

  14. #14
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,834

    Re: Find Duplicate Rows Where Two Columns Match

    OOPs,a typo
    Please Login or Register  to view this content.
    Attached Files Attached Files
    Last edited by jindon; 11-29-2017 at 11:17 AM. Reason: fixed a bug

  15. #15
    Forum Guru Sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2019 | 2021
    Posts
    14,958

    Re: Find Duplicate Rows Where Two Columns Match

    A bit unorthodox I guess....Think it does what is required....

    Please Login or Register  to view this content.

  16. #16
    Registered User
    Join Date
    05-01-2015
    Location
    United Kingdom
    MS-Off Ver
    Office 2013
    Posts
    12

    Re: Find Duplicate Rows Where Two Columns Match

    Thank you both so much for the time and help that you have given me. Both methods work perfectly.

    Many thanks

    Dom

  17. #17
    Forum Guru Sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2019 | 2021
    Posts
    14,958

    Re: Find Duplicate Rows Where Two Columns Match

    Glad I could contribute...tx for rep.

+ 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: 5
    Last Post: 12-18-2015, 10:21 AM
  2. [SOLVED] Find non-duplicate rows between columns Name and Tag
    By missy22 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 05-28-2014, 06:04 AM
  3. [SOLVED] Find exact match in multiple columns in 1 row with all other rows 90,000 rows.
    By KHurt in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 05-02-2013, 01:38 PM
  4. Find duplicate info in two columns and copy info from duplicate rows
    By USGS in forum Excel Formulas & Functions
    Replies: 8
    Last Post: 11-12-2011, 07:31 PM
  5. VBA code to find duplicate values within multiple rows and columns
    By pcbpinoy in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 10-27-2011, 09:04 PM
  6. How to find duplicate rows where columns contain data of different types
    By olechkq in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 12-07-2010, 01:18 PM
  7. Replies: 2
    Last Post: 03-27-2010, 12:43 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