+ Reply to Thread
Results 1 to 8 of 8

VBA find duplicates in in combined columns

  1. #1
    Registered User
    Join Date
    05-30-2018
    Location
    New York
    MS-Off Ver
    2010
    Posts
    3

    Post VBA find duplicates in in combined columns

    I'm trying to identify all duplicate names across an entire workbook and alert the data entry person. I have it working perfectly for Lname but can't get it to work for both Fname + Lname meaning I only want the message to trigger if Lname + Fname are not unique.
    e.g. If Sue Flockey exists on Sheet 1 and a user tries to enter Sue Flockey on Sheet 2 they would receive a message And no message if they enter 'Sue', OR 'Flockey' OR 'Bob Flockey'.

    My vba code evaluates as follows;
    Sheet2 evaluates Sheet1
    Sheet3 evaluates Sheet1 & Sheet2
    Sheet4 evaluates Sheet1, 2, & 3
    Sheet5 evaluates Sheet1, 2, 3, & 4
    ,... and so on to Sheet12

    I've also tried using concatenation on Lname + Fname in column Z but can't get my code to work on a calculated field even when using the Worksheet_Calculate()
    I've also played around with declaring a new Range A:B and A1:B59

    Here is the code I'm using (sample from Sheet3 aka June 2018)-

    Any help is much appreciated.

    Notes:
    Lname range is A6:A59
    Fname range is B6:B59
    My Concatenate\calculated field (if it's suggested to go this route) is Z6:Z59
    Please Login or Register  to view this content.
    Last edited by alansidman; 05-30-2018 at 09:11 PM.

  2. #2
    Forum Expert mrice's Avatar
    Join Date
    06-22-2004
    Location
    Surrey, England
    MS-Off Ver
    Excel 2013
    Posts
    4,967

    Re: VBA find duplicates in in combined columns

    Something like this might help on the ThisWorkbook tab.

    Please Login or Register  to view this content.
    Martin

  3. #3
    Registered User
    Join Date
    05-30-2018
    Location
    New York
    MS-Off Ver
    2010
    Posts
    3

    Re: VBA find duplicates in in combined columns

    this is good and thanks for the quick reply. although it now detects dups in my Fname (B) column it also detects dups in every other column. I only want to find dups if columns A + B are not unique.

  4. #4
    Forum Expert
    Join Date
    12-10-2006
    Location
    Sydney
    MS-Off Ver
    Office 365
    Posts
    3,525

    Re: VBA find duplicates in in combined columns

    Hi vandyker,

    Welcome to the forum!!

    Try this workbook event macro:

    Please Login or Register  to view this content.
    Note it's based on the range A6:B59 across all sheets as is not case sensitive.

    Regards,

    Robert
    ____________________________________________
    Please ensure you mark your thread as Solved once it is. Click here to see how
    If this post helps, please don't forget to say thanks by clicking the star icon in the bottom left-hand corner of my post

  5. #5
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2405 Win 11 Home 64 Bit
    Posts
    23,873

    Re: VBA find duplicates in in combined columns

    @ vandyker

    Code Tags Added
    Your post does not comply with Rule 3 of our Forum RULES. Use code tags around code.

    Posting code between [CODE]Please [url=https://www.excelforum.com/login.php]Login or Register [/url] to view this content.[/CODE] tags makes your code much easier to read and copy for testing, it also maintains VBA formatting.

    Highlight your code and click the # icon at the top of your post window. More information about these and other tags can be found at http://www.excelforum.com/forum-rule...rum-rules.html



    (I have added them for you today. Please take a few minutes to read all Forum Rules and comply in the future.)
    Alan עַם יִשְׂרָאֵל חַי


    Change an Ugly Report with Power Query
    Database Normalization
    Complete Guide to Power Query
    Man's Mind Stretched to New Dimensions Never Returns to Its Original Form

  6. #6
    Forum Expert mrice's Avatar
    Join Date
    06-22-2004
    Location
    Surrey, England
    MS-Off Ver
    Excel 2013
    Posts
    4,967

    Re: VBA find duplicates in in combined columns

    Variation making use of your helper column in column Z

    Please Login or Register  to view this content.

  7. #7
    Registered User
    Join Date
    05-30-2018
    Location
    New York
    MS-Off Ver
    2010
    Posts
    3

    Re: VBA find duplicates in in combined columns

    It works! Thank you Robert, nicely done!

  8. #8
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2405 Win 11 Home 64 Bit
    Posts
    23,873

    Re: VBA find duplicates in in combined columns

    If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED. 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 sort then next colums data combined
    By farrukh in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-30-2012, 06:04 PM
  2. Two Columns Combined into One Column w/ No Duplicates
    By usc1382 in forum Excel General
    Replies: 1
    Last Post: 01-16-2012, 01:37 PM
  3. Find min/max in 2 combined columns
    By Tammi in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 09-06-2005, 12:05 PM
  4. [SOLVED] Find min/max in 2 combined columns
    By Ken Wright in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 09-06-2005, 10:05 AM
  5. [SOLVED] Find min/max in 2 combined columns
    By Ken Wright in forum Excel Formulas & Functions
    Replies: 9
    Last Post: 09-06-2005, 04:05 AM
  6. Find min/max in 2 combined columns
    By Tammi in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-06-2005, 03:05 AM
  7. Find min/max in 2 combined columns
    By Tammi in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-05-2005, 11:05 PM
  8. Find min/max in 2 combined columns
    By Tammi in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 06-22-2005, 04:05 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