+ Reply to Thread
Results 1 to 9 of 9

Duplicates macro help

  1. #1
    Forum Contributor
    Join Date
    03-12-2014
    Location
    England
    MS-Off Ver
    Excel 2007
    Posts
    138

    Duplicates macro help

    Hi
    I am looking for a macro that will look at data in a worksheet "tab 1 column a" and if is duplicated in " tab 2 column a" then put the word match in "tab 2 column b" next to duplicated data.
    Any help appreciated
    Regards
    Last edited by shrubfact; 02-14-2017 at 09:50 PM.

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

    Re: Duplicates macro help

    Put this formula in Sheet2 B1 and copy down the column. Change the Sheet1 name to suit.

    =IF(A1="","",IF(COUNTIF(Sheet1!A:A,A1),"Match",""))
    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
    Forum Contributor
    Join Date
    03-12-2014
    Location
    England
    MS-Off Ver
    Excel 2007
    Posts
    138

    Re: Duplicates macro help

    hi thanks for the help. This worked perfectly but after some testing I am spotting some errors as its not showing some as a duplicate although it definitely is. Possibly where I am concatenating 5 cells and the formula is working with this ? I'm not sure.

    Would a better way be to look at the 5 cells in the row separately ?

  4. #4
    Forum Guru Winon's Avatar
    Join Date
    02-20-2007
    Location
    East Rand, R.S.A.
    MS-Off Ver
    2010
    Posts
    6,113

    Re: Duplicates macro help

    Hi shrubfact,

    To make things easier for all of us, I would suggest you attach a sample workbook.

    Make sure there is just enough data to demonstrate your need. Include a BEFORE sheet and an AFTER sheet in the workbook if needed to show the process you're trying to complete or automate. Make sure your desired results are shown, mock them up manually if necessary.

    Remember to desensitize the data.

    Click on GO ADVANCED and then scroll down to Manage Attachments to open the upload window.

    Regards.
    Please consider:

    Be polite. Thank those who have helped you. Then Click on the star icon in the lower left part of the contributor's post and add Reputation. Cleaning up when you're done. If you are satisfied with the help you have received, then Please do Mark your thread [SOLVED] .

  5. #5
    Forum Guru Winon's Avatar
    Join Date
    02-20-2007
    Location
    East Rand, R.S.A.
    MS-Off Ver
    2010
    Posts
    6,113

    Re: Duplicates macro help

    @ AlphaFrog,

    Maybe we should consider adding the Trim Function to your Formula?

    Just a wild guess.

    Regards.

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

    Re: Duplicates macro help

    I suspect for the duplicates that are missed, they are not an exact match. One of the two duplicates may have a trailing space character or something e.g.; "TextA" <> "TextA ".

    You could do a simple test with a formula like
    =A1=A10
    Where A1 and A10 are duplicates. It should return TRUE if they are exact matches.


    This formula would "Match" if any other cell contains the value from A1.
    =IF(A1="","",IF(COUNTIF(Sheet1!A:A,"*" & A1 & "*"),"Match",""))
    This could make false matches (TextA is contained in TextAB) depending on the nature of your data.

  7. #7
    Forum Contributor
    Join Date
    03-12-2014
    Location
    England
    MS-Off Ver
    Excel 2007
    Posts
    138

    Re: Duplicates macro help

    Hi winon

    ok will try and upload over next few days

    I did try trimming but still no luck

  8. #8
    Forum Contributor
    Join Date
    03-12-2014
    Location
    England
    MS-Off Ver
    Excel 2007
    Posts
    138

    Re: Duplicates macro help

    Hi alphafrog

    I will try that tomorrow at work to see if exact match

    Thankyou

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

    Re: Duplicates macro help

    Quote Originally Posted by shrubfact View Post
    Hi winon

    ok will try and upload over next few days

    I did try trimming but still no luck
    The Trim function wouldn't help with this formula. It only would trim one of the duplicates for any given row.

+ 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] Macro to find duplicates, concatenate cells, then delete old duplicates (2)
    By cny in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 05-22-2016, 06:05 AM
  2. Macro to find duplicates, concatenate cells, then delete old duplicates
    By givemepuppies in forum Excel Programming / VBA / Macros
    Replies: 17
    Last Post: 03-04-2016, 02:43 AM
  3. Replies: 1
    Last Post: 07-30-2014, 02:37 PM
  4. Replies: 2
    Last Post: 12-27-2013, 09:24 AM
  5. [SOLVED] Macro to find duplicates, concatenate Unique Values, then delete old duplicates
    By lesoies in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 09-17-2013, 04:32 PM
  6. Replies: 17
    Last Post: 07-05-2011, 05:37 PM
  7. Replies: 3
    Last Post: 03-09-2011, 07:00 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