+ Reply to Thread
Results 1 to 11 of 11

Extract data if there are duplicates in 1 column and different values in another

  1. #1
    Registered User
    Join Date
    01-16-2014
    Location
    Derby, England
    MS-Off Ver
    365
    Posts
    60

    Extract data if there are duplicates in 1 column and different values in another

    Hello!

    Looking to copy and paste data from one tab to another if there are duplicate values in one column but different values in another please. I have attached a sheet with an example of the before and output from the macro.


    Ultimately, I am trying to compile a list of suppliers that deliver to different locations and a CONCAT of the locations.

    In the example, you can see that supplier BB only delivers to one location so should be excluded from the list. whereas AA and CC deliver to multiple and should be listed with the locations noted as a concat.
    There would also be more columns to copy across such as town and post code along with the address.

    I hope that makes sense!

    Thank you for your time.
    Attached Files Attached Files

  2. #2
    Forum Guru Kaper's Avatar
    Join Date
    12-14-2013
    Location
    Warsaw, Poland
    MS-Off Ver
    most often: Office 365 in Windows environment
    Posts
    8,825

    Re: Extract data if there are duplicates in 1 column and different values in another

    First (may look side, but it is important) question: Are you still using excel 2010, as shown in your profile? If not please let us know and edit it in https://www.excelforum.com/profile.php?do=editprofile
    Best Regards,

    Kaper

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

    Re: Extract data if there are duplicates in 1 column and different values in another

    There would also be more columns to copy across such as town and post code along with the address.
    So...why not upload a sample file representing your actual file...So no time is wasted on supplying incorrect code...
    Also, as per your result...why is BB ignored?
    Last edited by Sintek; 11-05-2024 at 09:23 AM.
    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!!!

  4. #4
    Registered User
    Join Date
    01-16-2014
    Location
    Derby, England
    MS-Off Ver
    365
    Posts
    60

    Re: Extract data if there are duplicates in 1 column and different values in another

    Hi,
    Updated - forgot all about that bit!

  5. #5
    Registered User
    Join Date
    01-16-2014
    Location
    Derby, England
    MS-Off Ver
    365
    Posts
    60

    Re: Extract data if there are duplicates in 1 column and different values in another

    There are quite a few columns to copy across so wanted to focus on the ones that dictate the the output. I should hopefully be able to tweak the code to add in any additional columns if needed - amended the sheet

    "In the example, you can see that supplier BB only delivers to one location so should be excluded from the list"
    Attached Files Attached Files
    Last edited by madmoo84; 11-05-2024 at 09:46 AM.

  6. #6
    Forum Guru Kaper's Avatar
    Join Date
    12-14-2013
    Location
    Warsaw, Poland
    MS-Off Ver
    most often: Office 365 in Windows environment
    Posts
    8,825

    Re: Extract data if there are duplicates in 1 column and different values in another

    Try:
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    Sorting step could be added to avoid in second case A1 / B2 / B1

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

    Re: Extract data if there are duplicates in 1 column and different values in another

    So what are the unique keys here...Col C,D,E&F combined...

  8. #8
    Registered User
    Join Date
    01-16-2014
    Location
    Derby, England
    MS-Off Ver
    365
    Posts
    60

    Re: Extract data if there are duplicates in 1 column and different values in another

    Quote Originally Posted by Sintek View Post
    So what are the unique keys here...Col C,D,E&F combined...
    C,D,E&F with G

    So D, E and F will all match when C is the same i.e. it is the address for the suppler and each supplier has an individual code.

    Then if that supplier has more than one delivery location (G) it means it delivers to multiple sites so should be extracted along with it's address data and the the delivery locations and pasted into a new sheet but the each supplier should only be on one line with the delivery locations in one column

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

    Re: Extract data if there are duplicates in 1 column and different values in another

    Please Login or Register  to view this content.
    Attached Files Attached Files

  10. #10
    Registered User
    Join Date
    01-16-2014
    Location
    Derby, England
    MS-Off Ver
    365
    Posts
    60

    Re: Extract data if there are duplicates in 1 column and different values in another

    Hi,

    Thank you so much! I managed to tweak it to fit my sheet and it works perfectly. I am unable to add rep at the moment as I have to spread it around but as soon as I can I will add it!

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

    Re: Extract data if there are duplicates in 1 column and different values in another

    Glad you got it sorted...Happy Coding...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. [SOLVED] extract all values in column, excluding immediate duplicates only
    By chriswrcg in forum Excel Formulas & Functions
    Replies: 8
    Last Post: 03-19-2022, 03:01 PM
  2. [SOLVED] Formula Required to Extract data from Column A based on Non -zero values in Column B
    By Ramzan-ul-Mubarak in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 11-29-2019, 06:07 AM
  3. [SOLVED] Extract Unique values from the list of Duplicates and copy into another column
    By nadeemm in forum Excel Programming / VBA / Macros
    Replies: 19
    Last Post: 10-20-2018, 11:58 AM
  4. [SOLVED] Formula to Extract Unique Values/Remove Duplicates Across Multiple Columns of Data
    By Lanceh in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 08-24-2017, 09:07 AM
  5. Replies: 11
    Last Post: 10-27-2016, 07:33 PM
  6. Replies: 11
    Last Post: 02-05-2015, 07:13 PM
  7. [SOLVED] Find duplicates in column A, add values from column B (possibly delete duplicates)
    By luarwhite in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 07-12-2013, 04:34 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