+ Reply to Thread
Results 1 to 13 of 13

Compare & Remove Rows

  1. #1
    Registered User
    Join Date
    02-13-2018
    Location
    Doncaster, England
    MS-Off Ver
    2016
    Posts
    6

    Question Compare & Remove Rows

    Hi, I searched and found a few different ways people have solved similar problems to mine, but was unable to apply them to my situation.

    I have a csv export of a database that looks like:

    LastName FirstName Initials Title Keycode TokenFormat Disabled StartDate EndDate Email EmployeeNumber DateOfBirth WorkTelephone HomeTelephone MobileTelephone SecurityLevel RequiresExtraDoorTime PIN Memo OrgUnitName AccessGroups CategoryName ExtraInfo1 ExtraInfo2 Photo
    Bristow Gillian D60AD8C2 FALSE 01/01/1970 C:\IDPhotos\0000011685.png

    And a report of people that need to be removed that looks like:

    LastName FirstName
    Bristow Gillian

    Its probably simple, but how can I remove each row from the first spreadsheet, if their LastName & FirstName are found in the second spreadsheet?

    Thank you in advance for any help

  2. #2
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,430

    Re: Compare & Remove Rows

    Welcome to the forum!

    Firstly, let's get the terminology right: columns are vertical, rows are horizontal. Are you simply wanting to remove the extra columns? If so, just copy and paste the first two. Or are you asking for something else? If the latter, then you are going to need to elaborate.
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    Forum Rules (updated August 2023): please read them here.

  3. #3
    Registered User
    Join Date
    02-13-2018
    Location
    Doncaster, England
    MS-Off Ver
    2016
    Posts
    6

    Re: Compare & Remove Rows

    My apologies. That was only a 1 row example. My file has thousands of rows of data. Some have blank columns, some filled.

    I want to remove the whole row in the first spreadsheet, if the first and last name appear in the second spreadsheet.

    For example (from the table I put on my original post), Gillian Bristow appears in the second table, so I want to remove it from the first.

    I have to have it check both first and last name as in my spreadsheet, there are multiple rows with the same Last Name.
    Last edited by AliGW; 02-13-2018 at 09:33 AM. Reason: Unnecessary quotation removed.

  4. #4
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,430

    Re: Compare & Remove Rows

    OK - I understand. You will need VCBA for this, so I will move your thread to the correct section.

    Will you please attach a sample Excel workbook? Nobody wants to have to recreate your data from scratch.

    1. Make sure that your sample data are REPRESENTATIVE of your real data. The use of unrepresentative data is very frustrating and can lead to long delays in reaching a solution.

    2. Make sure that your desired results are also shown (mock up the results manually).

    3. Make sure that all confidential data is removed or replaced with dummy data first (e.g. names, addresses, E-mails, etc.).

    4. Try to avoid using merged cells as they cause lots of problems.

    Unfortunately the attachment icon doesn't work at the moment, so to attach an Excel file you have to do the following: just before posting, scroll down to Go Advanced and then scroll down to Manage Attachments. Now follow the instructions at the top of that screen.

    Please pay particular attention to point 2 (above): without an idea of your intended outcomes, it is often very difficult to offer appropriate advice.

    Also, please don't quote whole posts, especially when you are responding to the one immediately preceding your own - it's just clutter. It's OK to quote if you are responding to a post out of sequence, but limit quoted content to a few relevant lines that makes clear to whom and what you are responding. Thanks!

    For normal conversational replies, try using the QUICK REPLY box below.

  5. #5
    Registered User
    Join Date
    02-13-2018
    Location
    Doncaster, England
    MS-Off Ver
    2016
    Posts
    6

    Re: Compare & Remove Rows

    Thank you.

    I have attached a sample file.

    There are 3 workbooks, the database, the data to be removed, the expected result.
    Attached Files Attached Files

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

    Re: Compare & Remove Rows

    Try
    Please Login or Register  to view this content.

  7. #7
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,430

    Re: Compare & Remove Rows

    Jindon - I think the OP might need a bit of guidance with how to implement this.

    EDIT: I was wrong!
    Last edited by AliGW; 02-13-2018 at 10:33 AM.

  8. #8
    Registered User
    Join Date
    02-13-2018
    Location
    Doncaster, England
    MS-Off Ver
    2016
    Posts
    6

    Re: Compare & Remove Rows

    Thank you for that!

    It has partly helped.

    Using that, it has removed rows where there was only a LastName specified in the "To Remove" worksheet.

    It hasn't removed the ones that have both LastName & FirstName completed.

    Any further suggestions?

    Thanks in advance

    Have double checked my data, as I hadn't realised there would be blank cells before.

    The LastName cell is always populated, and there are some rows where FirstName is blank
    Last edited by rharris118; 02-13-2018 at 10:35 AM. Reason: Extra Information

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

    Re: Compare & Remove Rows

    It should only delete the matched data for both Last/Frist name together.

    I can not replicate that situation, so upload a workbook that you have problem.

  10. #10
    Registered User
    Join Date
    02-13-2018
    Location
    Doncaster, England
    MS-Off Ver
    2016
    Posts
    6

    Re: Compare & Remove Rows

    Attached a more complete dataset
    Attached Files Attached Files

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

    Re: Compare & Remove Rows

    OK, change to
    Please Login or Register  to view this content.

  12. #12
    Valued Forum Contributor
    Join Date
    11-28-2015
    Location
    indo
    MS-Off Ver
    2016 64 bitt
    Posts
    1,256

    Re: Compare & Remove Rows

    Please Login or Register  to view this content.
    Last edited by daboho; 02-13-2018 at 11:50 AM.

  13. #13
    Registered User
    Join Date
    02-13-2018
    Location
    Doncaster, England
    MS-Off Ver
    2016
    Posts
    6

    Re: Compare & Remove Rows

    Thanks for your help. That worked but for some reason missed removing some of the data, it seemed to not go all the way through the file. It finished running almost instantly.

+ 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] Compare data from two rows - remove duplicates
    By Mike Mosley in forum Excel General
    Replies: 2
    Last Post: 03-01-2017, 01:11 PM
  2. Code to remove compare and remove duplicate value between 2 columns
    By winmaxservices1 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 01-22-2015, 02:30 PM
  3. Replies: 1
    Last Post: 10-23-2012, 09:12 AM
  4. [SOLVED] Compare two rows of numbers. Remove the duplicates
    By nicdyb in forum Excel Formulas & Functions
    Replies: 8
    Last Post: 06-20-2012, 06:08 AM
  5. Replies: 1
    Last Post: 09-11-2010, 06:11 PM
  6. Replies: 1
    Last Post: 09-11-2010, 05:38 PM
  7. compare 2 sheets and remove identical rows in sheet 2
    By VBisgreat in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 12-18-2009, 04:41 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