Results 1 to 4 of 4
  1. #1
    Lounger
    Join Date
    Jan 2001
    Location
    Rockford, Illinois, USA
    Posts
    35
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Comparing columns of data (Excel 97 sr2)

    I have two columns of data that I need to compare. If the values in the columns are the same, I want to delete the row that they are in. Is there an easy way to do this?

  2. #2
    2 Star Lounger
    Join Date
    Dec 2000
    Posts
    120
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Comparing columns of data (Excel 97 sr2)

    I would add a column a formula to compare the two columns, something like:

    =if(A1=B1,0,1)

    This will give you a 0 if they match and a 1 if they don't, you can then sort on that column which will bring all the 0 to the top where you can delete them.

  3. #3
    Platinum Lounger
    Join Date
    Nov 2001
    Location
    Vienna, Wien, Austria
    Posts
    5,009
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Comparing columns of data (Excel 97 sr2)

    If you have to do this in any volume or repetitively, you can set up a macro to do this. Provided you have no blank cells, pseudo code would roughly be:

    <pre>Sub CheckForEnd()
    If Selection.Value <> "" Then
    DeleteMatches
    Else: Exit Sub
    End If
    End Sub</pre>


    <pre>Sub DeleteMatches()
    If Selection.Value = Selection.Offset(0, 1).Value Then
    Selection.EntireRow.Delete
    Else: Selection.Offset(1, 0).Select
    End If
    CheckForEnd
    End Sub</pre>


    HTH
    Gre

  4. #4
    Lounger
    Join Date
    Jan 2001
    Location
    Rockford, Illinois, USA
    Posts
    35
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Comparing columns of data (Excel 97 sr2)

    I will give it a try. Thanks again for your help.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •