+ Reply to Thread
Results 1 to 11 of 11

Find Duplicates across 13 Columns

  1. #1
    Registered User
    Join Date
    02-27-2018
    Location
    TX
    MS-Off Ver
    2016
    Posts
    54

    Find Duplicates across 13 Columns

    Hello all,

    I am trying to find a way to locate exact duplicates across 13 columns of data. The worksheet that I'm using as a template has a VBA written that looks like the below:

    ' Final check is to see if there are duplicate rows. This is just informational. If a duplicate exists then the duplicate rows are colored yelow
    Set duplicateRows = CreateObject("Scripting.Dictionary")
    For x = 22 To rowData
    dupRow = wsData.Range("B" & x).Value & wsData.Range("C" & x).Value & wsData.Range("D" & x).Value & wsData.Range("D" & x).Value & wsData.Range("E" & x).Value & _
    wsData.Range("F" & x).Value & wsData.Range("G" & x).Value & wsData.Range("H" & x).Value & wsData.Range("I" & x).Value & wsData.Range("J" & x).Value & _
    wsData.Range("K" & x).Value & wsData.Range("L" & x).Value

    If Not duplicateRows.exists(dupRow) Then
    duplicateRows.Add dupRow, x
    Else
    wsData.Range("B" & x & ":N" & x).Interior.ColorIndex = 36
    wsData.Range("B" & duplicateRows(dupRow) & ":N" & duplicateRows(dupRow)).Interior.ColorIndex = 36
    End If

    Next x

    I'm trying to figure out what changes I need to make to have this apply to my worksheet. I have attached an example.

    Thank you!

    CROSS-POSTED - https://www.mrexcel.com/forum/excel-...3-columns.html
    Attached Files Attached Files
    Last edited by mrsbrannon; 03-29-2018 at 12:08 PM.

  2. #2
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,643

    Re: Find Duplicates across 13 Columns

    Here's an alternate method using conditional formatting.

    Highlight Duplicate Records
    Surround your VBA code with CODE tags e.g.;
    [CODE]your VBA code here[/CODE]
    The # button in the forum editor will apply CODE tags around your selected text.

  3. #3
    Registered User
    Join Date
    02-27-2018
    Location
    TX
    MS-Off Ver
    2016
    Posts
    54

    Re: Find Duplicates across 13 Columns

    Quote Originally Posted by AlphaFrog View Post
    Here's an alternate method using conditional formatting.

    Highlight Duplicate Records
    Will this work for large amounts of data? I may have up to 100 rows of data to compare and need exact matches only across the 13 columns.

  4. #4
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Find Duplicates across 13 Columns

    This will work for 14 Columns:

    Please Login or Register  to view this content.
    If I've helped you, please consider adding to my reputation - just click on the liitle star at the left.

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~(Pride has no aftertaste.)

    You can't do one thing. XLAdept

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~aka Orrin

  5. #5
    Registered User
    Join Date
    02-27-2018
    Location
    TX
    MS-Off Ver
    2016
    Posts
    54

    Re: Find Duplicates across 13 Columns

    Tried copying and pasting onto my worksheet. Didn't work.

  6. #6
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Find Duplicates across 13 Columns

    Hi Mrs Brannon,

    If you haven't used macros before you'll need to go to:
    File- options - trust center -trust center settings - macro settings ,
    the second option down (disable all macros with notification)

    Then - Copy the code to the clipboard

    Open your Workbook

    Press ALT + F11 to open the Visual Basic Editor.

    Select "Module" from the Insert menu

    Type "Option Explicit" then paste the code under it

    With the cursor between Sub and End Sub press F5 (F8 to Single Step)

    OR

    Press ALT + Q to close the code window.

    Press ALT + F8 then double click on the macro name
    *Be sure to save the book with the code as Macro-Enabled

  7. #7
    Registered User
    Join Date
    02-27-2018
    Location
    TX
    MS-Off Ver
    2016
    Posts
    54

    Re: Find Duplicates across 13 Columns

    "Run-time error '13'
    Type mismatch

  8. #8
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Find Duplicates across 13 Columns

    Does your data start in row 2? Do you have a reference to Microsoft Scripting Runtime? Which line was highlighted?

  9. #9
    Registered User
    Join Date
    02-27-2018
    Location
    TX
    MS-Off Ver
    2016
    Posts
    54

    Re: Find Duplicates across 13 Columns

    Yes, row 2. No idea on the Microsoft Scripting Runtime and no lines were highlighted.

  10. #10
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Find Duplicates across 13 Columns

    In the VBE (that's the window where you can see the code) Click on Tools - References - Microsoft Scripting Runtime.

    If that doesn't fix it, I'll need to see a sample where it fails

  11. #11
    Registered User
    Join Date
    02-27-2018
    Location
    TX
    MS-Off Ver
    2016
    Posts
    54

    Re: Find Duplicates across 13 Columns

    Okay, thank you. I did it but I still don't see it working. I'm going to try a couple of things and I'll let you know if I can't figure something out. Thanks!

+ 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. Find Duplicates across 2 pairs of columns (2 columns against 2 columns)
    By erjfly2013 in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 03-09-2015, 06:52 PM
  2. Find duplicates between two columns
    By mints.maksim in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 07-19-2013, 01:48 AM
  3. [SOLVED] Need to find duplicates across three columns
    By lost&found in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 12-06-2012, 04:48 PM
  4. How to find duplicates on multiple columns (3 Columns )
    By Kaleemuddin in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 09-19-2012, 07:04 AM
  5. To find out the duplicates in the columns
    By piyushau in forum Excel General
    Replies: 5
    Last Post: 07-30-2012, 08:53 PM
  6. Replies: 1
    Last Post: 02-13-2012, 08:08 PM
  7. Is there a better way to find duplicates in columns?
    By 111StepsAhead in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 10-28-2011, 03:02 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