+ Reply to Thread
Results 1 to 10 of 10

Compare Column 1 to Col 2, if data in Col1 = Col2, remove the row containing that data

  1. #1
    Forum Contributor
    Join Date
    10-16-2012
    Location
    Brooklyn
    MS-Off Ver
    Excel 2010 PC
    Posts
    137

    Compare Column 1 to Col 2, if data in Col1 = Col2, remove the row containing that data

    Hi. I'm having a problem that I need help with. Here it is.

    I have two columns of data. Each contains a 1 to 3 digit code. I need to compare column A to column B and if a code in A = a code in B, I need the entire row that intersects the cell in column A to be removed. Let me give the example:

    (The information in Column B is in a separate worksheet but in the same work book.)

    Worksheet 1 Worksheet 2
    A B C D A
    1 CL random data numbers 1 DBA
    2 BC random data numbers 2 BL
    3 DLB random data numbers 3 CL
    4 ABA random data numbers 4 ST

    Now what I've been trying to do, is have Column A in Sheet1 compare to Column A in sheet 2, and if the cells are equal (CL = CL), then remove the entire 'CL' containing row in worksheet 1.

    I've tried in vein to solve this. Can anyone help please?

  2. #2
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Compare Column 1 to Col 2, if data in Col1 = Col2, remove the row containing that data

    Try one of these codes

    Please Login or Register  to view this content.
    Please Login or Register  to view this content.
    Last edited by AB33; 12-04-2012 at 02:39 PM.

  3. #3
    Forum Contributor
    Join Date
    10-16-2012
    Location
    Brooklyn
    MS-Off Ver
    Excel 2010 PC
    Posts
    137

    Re: Compare Column 1 to Col 2, if data in Col1 = Col2, remove the row containing that data

    @AB33.
    I tested that code out. It did remove some of the data but not the data I wanted. I'm not actually sure what it removed. Here's what I'm trying to do: There's a list of a few codes in column A of Sheet1 and a list of a few hundred codes in column A of sheet 2. I'm trying to remove all of the rows of data from sheet 2 that share the same column A codes as the column A in sheet 1. I wish there was a way for me to post a downloadable example.
    Thanks anyway for your help.
    Trev-

  4. #4
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Compare Column 1 to Col 2, if data in Col1 = Col2, remove the row containing that data

    I do not know with out seeing the worksheets, but I have amended the first code and try it

  5. #5
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Compare Column 1 to Col 2, if data in Col1 = Col2, remove the row containing that data

    You could also try this code

    Please Login or Register  to view this content.
    Last edited by AB33; 12-04-2012 at 03:43 PM.

  6. #6
    Forum Contributor
    Join Date
    10-16-2012
    Location
    Brooklyn
    MS-Off Ver
    Excel 2010 PC
    Posts
    137

    Re: Compare Column 1 to Col 2, if data in Col1 = Col2, remove the row containing that data

    @AB33

    I wasn't able to get that to work. However, I did manage to attach an example this time.
    Thanks for your patience.


    ExcelForumExample.xls

  7. #7
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Compare Column 1 to Col 2, if data in Col1 = Col2, remove the row containing that data

    Okay,
    I have tested it and works(post 2 code 2). To check the code works, you can run this code and see items found on both sheets are coloured red. Test it yourself

    Please Login or Register  to view this content.

  8. #8
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Compare Column 1 to Col 2, if data in Col1 = Col2, remove the row containing that data

    You should also try code post no 5

  9. #9
    Forum Contributor
    Join Date
    10-16-2012
    Location
    Brooklyn
    MS-Off Ver
    Excel 2010 PC
    Posts
    137

    Re: Compare Column 1 to Col 2, if data in Col1 = Col2, remove the row containing that data

    @AB33

    It Works!
    Thanks for your time and patience.

  10. #10
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Compare Column 1 to Col 2, if data in Col1 = Col2, remove the row containing that data

    Glad to be helpfull!

    You are welcome!

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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