+ Reply to Thread
Results 1 to 12 of 12

Excel VBA Find duplicates plus check criteria and move value to other column

  1. #1
    Registered User
    Join Date
    09-22-2021
    Location
    London
    MS-Off Ver
    Office 2019
    Posts
    9

    Lightbulb Excel VBA Find duplicates plus check criteria and move value to other column

    Dear Excel Community

    I would like to use VBA code to
    to find duplicate entries and 2 criteria should be checked and another column. Last but not least, I would like to see the result of the text in one of the columns.

    column D (article numbers 51541, 51541 , 51542, 51544 etc.)
    find duplicates here first

    As soon as a duplicate is found
    E.g. 51541 - should be searched for in column B according to 2 criteria, namely "Web" and "Flyer", which are shown as text in column B respectively and e.g:
    Column B / Column D
    1. advertising november flyer / 51541
    2. advertising november web / 51541


    If both criteria are present/fulfilled, then please add/show "web and flyer" in column C with text. Here is the example:


    Column B / Column C / Column D
    1. advertising november flyer/ web and flyer / 51541
    2. advertising november web / web and flyer/ 51541


    I am hoping for a super simple VBA macro solution and am open to ideas.

    Thank you in advance for your time and help and I look forward to seeing the solution.
    Last edited by shagoo; 09-22-2021 at 12:33 PM. Reason: SLOVED

  2. #2
    Valued Forum Contributor
    Join Date
    11-04-2018
    Location
    Denpasar
    MS-Off Ver
    Excel 2010
    Posts
    777

    Re: Excel VBA Find duplicates plus check criteria and move value to other column

    If I'm not mistaken to get what you mean :
    Please Login or Register  to view this content.
    The code assumed that there will only two duplicate values as in your example:
    column D (article numbers 51541, 51541 , 51542, 51544 etc.)
    Number 51541 exist only two times.
    So if there is another numbers which are duplicate, then it happen also only two times.
    For example, there is duplicate number which is 51549 --> so, 51549 in one row and another 51549 in another row. Just that.
    Last edited by karmapala; 09-22-2021 at 06:44 AM.

  3. #3
    Forum Guru bakerman2's Avatar
    Join Date
    10-03-2012
    Location
    Antwerp, Belgium
    MS-Off Ver
    MO Prof Plus 2016
    Posts
    6,907

    Re: Excel VBA Find duplicates plus check criteria and move value to other column

    Take a look at the top yellow banner on how to post an example file.
    Avoid using Select, Selection and Activate in your code. Use With ... End With instead.
    You can show your appreciation for those that have helped you by clicking the * at the bottom left of any of their posts.

  4. #4
    Registered User
    Join Date
    09-22-2021
    Location
    London
    MS-Off Ver
    Office 2019
    Posts
    9

    Re: Excel VBA Find duplicates plus check criteria and move value to other column

    Thank you for your quick reply.

    You are close to the solution. I am impressed!
    Regarding duplicates, of course there can be more than two.

    I noticed that column "C" also shows non-duplicate values from column "D". I would be happy if only the duplicates were shown in column "C".

    Enclosed I send you my Excel example data sheet to look at and better understand what I mean. (CHECK Attachment)
    In the second data sheet you can see "How it should look".

    I hope you can help me and I am sure you can do this step. Thank you very much and I appreciate your help.
    Attached Files Attached Files

  5. #5
    Registered User
    Join Date
    09-22-2021
    Location
    London
    MS-Off Ver
    Office 2019
    Posts
    9

    Re: Excel VBA Find duplicates plus check criteria and move value to other column

    have a look - thank you for the effort and your time. thanks for the file tipp above :-)

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

    Re: Excel VBA Find duplicates plus check criteria and move value to other column

    try
    Please Login or Register  to view this content.
    Last edited by jindon; 09-22-2021 at 08:46 AM.

  7. #7
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,122

    Re: Excel VBA Find duplicates plus check criteria and move value to other column

    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 star to left of post [Add Reputation]
    Also....add a comment if you like!!!!
    And remember...Mark Thread as Solved.
    Excel Forum Rocks!!!

  8. #8
    Registered User
    Join Date
    09-22-2021
    Location
    London
    MS-Off Ver
    Office 2019
    Posts
    9

    Re: Excel VBA Find duplicates plus check criteria and move value to other column

    Quote Originally Posted by jindon View Post
    try
    Please Login or Register  to view this content.

    Thank you for the quick support and response.

    Unfortunately there are still small bugs and I am sure it can be solved. I continue to hope for your good help.

    Sintek your solution is close.

    However, the value in column "B" is not taken into account and the criteria are not always considered.

    I also noticed that the duplicates have to be placed one below the other, could you do it differently? if not that's ok leave it.

    It is mainly important to me that the duplicates are found and that the two criteria are taken into account. See my comments in the new data sheet and how it should look in the second data sheet.

    I have marked the error on my example file table v2.
    Thank you very much and I will be happy to rate you generously.

    Cheers
    Attached Files Attached Files

  9. #9
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,122

    Re: Excel VBA Find duplicates plus check criteria and move value to other column

    Please Login or Register  to view this content.
    Last edited by sintek; 09-22-2021 at 09:22 AM.

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

    Re: Excel VBA Find duplicates plus check criteria and move value to other column

    Try change
    Please Login or Register  to view this content.
    to
    Please Login or Register  to view this content.

  11. #11
    Registered User
    Join Date
    09-22-2021
    Location
    London
    MS-Off Ver
    Office 2019
    Posts
    9

    Re: Excel VBA Find duplicates plus check criteria and move value to other column

    thank you very much for all good ideas and effored - finally SLOVED.
    For your efforts, leave you genre good feedbacks on your profiles.
    I ask for your patience - I have to prepare & eat dinner.

  12. #12
    Valued Forum Contributor
    Join Date
    11-04-2018
    Location
    Denpasar
    MS-Off Ver
    Excel 2010
    Posts
    777

    Re: Excel VBA Find duplicates plus check criteria and move value to other column

    Correction
    Please Login or Register  to view this content.
    Since I still don't know what if there are four duplicate numbers
    where three of them has text either "web" or "flyer" but the doesn't have it...
    So I assumed that those three duplicate will have the "web and flyer",
    but other duplicate will not have the "web and flyer", because it doesn't have any text ("web" or "flyer") in it.
    so I assumed that those three
    Last edited by karmapala; 09-22-2021 at 01:03 PM.

+ 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: 8
    Last Post: 08-12-2019, 07:00 AM
  2. Export from Excel to Access but check 2 criteria to ensure no duplicates
    By DannyJ in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 10-31-2016, 05:26 AM
  3. [SOLVED] Find Duplicates in column and then based on row criteria delete the row of that Duplicate
    By bobberuk in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 01-23-2016, 01:56 PM
  4. Find Duplicates & Move Data Based on its criteria
    By ryanparrish1986 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 05-28-2013, 08:44 AM
  5. [SOLVED] Macro to find column with duplicates, for each of those check another column for duplicate
    By MaartenKoller in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 05-17-2013, 10:09 AM
  6. Find Duplicates and move a selected cell to another column
    By scottie72 in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 08-24-2012, 09:33 AM
  7. [SOLVED] Find Duplicates, check value in another column for each duplicate
    By labrooy in forum Excel Formulas & Functions
    Replies: 14
    Last Post: 08-09-2012, 06:57 PM

Tags for this Thread

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