+ Reply to Thread
Results 1 to 19 of 19

combining 2 sets of data, deleting uncommon names

  1. #1
    Registered User
    Join Date
    10-20-2010
    Location
    Florida
    MS-Off Ver
    Excel 2007
    Posts
    10

    combining 2 sets of data, deleting uncommon names

    I'm new to this forum. I've copied and pasted 2 sets of data from Crystal Reports into a single worksheet. I now have 2 columns with names (Column D and E), but not all the names are in Column E. I want to delete those names in D that are not in Column E. I also have address and zip in Column A, B, and C that I need to keep matched up to the names in Column E. In other words, if the name isn't in Column D, I want to get rid of them in A,B,C, and D. Thanks for any help you can give.

  2. #2
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: combining 2 sets of data, deleting uncommon names

    1) In an empty column, put this formula in row2:

    =ISNUMBER(MATCH($D2, $E:$E, 0))

    2) Copy that downward so that it goes down as far as there is data in column D.

    3) Highlight the new column

    4) Select Data > Filter to turn on the AutoFilter

    5) Filter that column for FALSE

    6) Select all the visible rows in A:D

    7) Select Edit > Delete > Shift Up

    8) Turn off the Autofilter and clear the column you added
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

  3. #3
    Registered User
    Join Date
    10-20-2010
    Location
    Florida
    MS-Off Ver
    Excel 2007
    Posts
    10

    Re: combining 2 sets of data, deleting uncommon names

    I think I erred in my first post. I meant "In other words, if the name isn't in Column E, I want to get rid of them in A,B,C, and D. So I have over 7000 names in Column D with corresponding addresses in A,B, and C, and I need to match them to the approx. 3000 names in column E. I tried the solution above but it did not work, obviously because I gave incorrect information. Thanks.

  4. #4
    Valued Forum Contributor ron2k_1's Avatar
    Join Date
    09-30-2009
    Location
    Not the USA
    MS-Off Ver
    Excel 2003, 2007
    Posts
    606

    Re: combining 2 sets of data, deleting uncommon names

    I believe if you turn on AutoFilter would solve your problem,

    1. Click on you your header row
    2. Select Data > Filter to turn on the AutoFilter
    3. Select header for Col E, and select non-blanks

    This will not delete the other rows but at least they will not show for blank records found on Col E. This recommendation is assuming that when you mention "...but not all the names are in Column E..." that there are names on columns E that will match to column D, however, Column E has lots of blank cells.

    Another way to do it is by sorting by Col E, and then deleting all those records that are blank on Column E, and the resorting by whatever order you want them.

    EDIT: If this doesn't take care of what you want. Take the time to produce us a sample file similar to your workbook representing the very same issues you're facing and telling us what results you want.
    Ron
    Knowledge is knowing that a tomato and pepper are fruits. Wisdom is knowing whether to put these in a fruit salad

    Kindly

    [1] Use code tags. Place "[code]" before the first line of code and "[/code"]" after the last line of code. Exclude quotation marks
    [2] Mark your post [SOLVED] if it has been answered satisfactorily by editing your original post in advanced mode.
    [3] Thank (using the little scale) those that provided useful help; its nice and its very well appreciated

  5. #5
    Registered User
    Join Date
    10-20-2010
    Location
    Florida
    MS-Off Ver
    Excel 2007
    Posts
    10

    Re: combining 2 sets of data, deleting uncommon names

    I don't have any blanks in the spreadsheet except below the last entry in Col E-Col P. I have about 2000 names/data in Col A-Col D, but only 1000 names in Col E. If the name isn't in E, I want to remove it from Col D, and it's associated address info from Col A-C, so that the remaining names and address match what's in Col E.
    Last edited by annelayton; 11-03-2010 at 05:39 PM.

  6. #6
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: combining 2 sets of data, deleting uncommon names

    Based on your repeated description in post #5, the step by step instructions provided in post #2 do what you want. It can't get any better than that unless I come to your house. (nudge)

  7. #7
    Registered User
    Join Date
    10-20-2010
    Location
    Florida
    MS-Off Ver
    Excel 2007
    Posts
    10

    Smile Re: combining 2 sets of data, deleting uncommon names

    OK, I created a duplicate worksheet but changed the names and addresses. I'd appreciate any help you could give. Thanks!!

  8. #8
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: combining 2 sets of data, deleting uncommon names

    The only detail you left out is the these were not "exact match" strings. You've got other junk in column D that has to be removed for the match test to work. So the corrected instructions would be:


    1) In an empty column, put this formula in row2:

    =IF(ISNUMBER(SEARCH("(", $D2)), ISNUMBER(MATCH(TRIM(LEFT($D2, FIND("(",$D2)-1)),$E:$E, 0)))

    2) Copy that downward so that it goes down as far as there is data in column D.

    3) Highlight the new column

    4) Select Data > Filter to turn on the AutoFilter

    5) Filter that column for FALSE

    6) Select all the visible rows in A:D

    7) Select Edit > Delete > Shift Up

    8) Turn off the Autofilter and clear the column you added



    BTW, you've also got stray "spaces" hidden in the text strings in column E creating false FALSE results. Like Mecrazy, Shameka should match, but the hidden trailing space in E15 keeps it from working. You've got some data cleanup to do.

  9. #9
    Registered User
    Join Date
    10-20-2010
    Location
    Florida
    MS-Off Ver
    Excel 2007
    Posts
    10

    Re: combining 2 sets of data, deleting uncommon names

    I cleaned up the data in Column D and deleted the hidden text strings. I followed the steps in both Post #2 and Post #8, but everything in the new column returns FALSE. Once I get to Step 7 in Post #8, how do I select Edit? I don't see an Edit tab other than Home>Editing, but there's no Delete.

    Thanks

  10. #10
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: combining 2 sets of data, deleting uncommon names

    Highlight the visible rows in A:D that you want to delete, right-click the selected range and select Delete > Shift Up

  11. #11
    Registered User
    Join Date
    10-20-2010
    Location
    Florida
    MS-Off Ver
    Excel 2007
    Posts
    10

    Re: combining 2 sets of data, deleting uncommon names

    I'm going to try this again. I copied and pasted Col A-D from a Crystal Report. It contains, in order A: City, State, Zip, B: Zip, C: Street Address, D: Patient Name. There are 6000+ entries which represent every patient we have ever seen.

    From another Crystal Report, I have Col E-N which represents only patients seen in the past 3 years. Those columns contain other Patient information, including the Patient Name in Col E, but it does not contain any address information. There are only about 3000+ entries in these columns.

    I want to eliminate the Patient information in Col A-D where the Patient name is not in Col. E. Then I need to sort by zip code to find patients in a particular geographic area for marketing purposes. I know how to clean up the the addresses after that.

    Thanks

  12. #12
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: combining 2 sets of data, deleting uncommon names

    I didn't see a smaller excerpted workbook demonstrating all that...be sure to attach that.

  13. #13
    Registered User
    Join Date
    10-20-2010
    Location
    Florida
    MS-Off Ver
    Excel 2007
    Posts
    10

    Re: combining 2 sets of data, deleting uncommon names

    OK, I've attached another test document. I changed the names to protect the innocent. I also deleted a few columns, including one that showed date of birth. Thanks so much for your help.
    Attached Files Attached Files

  14. #14
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: combining 2 sets of data, deleting uncommon names

    1) Insert an empty column in column E, splitting your two datasets by the new empty column

    2) Put this formula in E2:

    =OR(ISNUMBER(MATCH(TRIM(D19),F:F, 0)),ISNUMBER(MATCH(D19,F:F, 0)))

    2) Copy that downward so that it goes down as far as there is data in column D.

    3) Highlight column E

    4) Select Data > Filter to turn on the AutoFilter

    5) Filter that column for FALSE

    6) Select all the visible rows in A:D

    7) Select Edit > Delete > Shift Up

    8) Turn off the Autofilter and clear column E

    9) Sort the data by column B.
    Last edited by JBeaucaire; 12-12-2010 at 03:01 AM. Reason: Corrected formula, there is still a ton of hidden spaces in that data.

  15. #15
    Registered User
    Join Date
    10-20-2010
    Location
    Florida
    MS-Off Ver
    Excel 2007
    Posts
    10

    Re: combining 2 sets of data, deleting uncommon names

    When I filter for False, everything returns as False. If I filter for True, everything returns as True.

    Thanks,
    Anne

  16. #16
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: combining 2 sets of data, deleting uncommon names

    When I did that on the sample sheet above it worked, so let's see yours.

  17. #17
    Registered User
    Join Date
    10-20-2010
    Location
    Florida
    MS-Off Ver
    Excel 2007
    Posts
    10

    Re: combining 2 sets of data, deleting uncommon names

    When I copy the formula into the newly created E2 and copy it down, it shows TRUE and FALSE all the way down the column before I click on Filter. Also, I've manually worked down thru the name Colang...., but entries above and below that name seem to be random True or False. I can't attache it because it has patient information. I don't have to have the information in columns after E if that helps any. Thanks

  18. #18
    Registered User
    Join Date
    10-20-2010
    Location
    Florida
    MS-Off Ver
    Excel 2007
    Posts
    10

    Re: combining 2 sets of data, deleting uncommon names

    Also, even though Rows 24, 63, 143, 255, and a few others are a match, they say FALSE before I click on Data > Filter.

  19. #19
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: combining 2 sets of data, deleting uncommon names

    Quote Originally Posted by annelayton View Post
    I can't attache it because it has patient information.

    It shouldn't take you more than 5 minutes to desensitize a copy of your workbook.

    In the name field, change the first name to Name1, the grab the lower right corner of that cell to "drag-down" the value and it will put Name2, Name3, etc going down the list.

    Repeat the with phone numbers, or SSNs, or any field that needs to remain in the sample workbook to demonstrate the issue properly. Any other columns could simply be cleared (all except the row1 with your titles, leave that...)

    You get the idea. A few minutes work on your part should easily create a non-sensitive example workbook that we can look at together to discover the problem you're having.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

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