find differences between two columns

  • Thread starter Thread starter David Kennedy
  • Start date Start date
D

David Kennedy

Hi,

Can anyone show me how to find differences between two columns ie..
Col A Col B
100 100
106 108
2500 2500
2999 2999

106 is not in Col B and 108 is not in Col A.
can it be done using a function? ,could you also show me code to do this?

Thanks in advance ,
David
 
Hello David,

Have a go with the following code:

Sub CheckTheDifference()
Dim iRow As Integer
Dim iCol As Integer
Dim x As Integer

iRow = ActiveCell.Row
iCol = ActiveCell.Column

For x = 0 To 10
If Cells(iRow + x, iCol).Value <> Cells(iRow + x, iCol + 1).Value
Then
MsgBox "The cells on row " & iRow + x & " do not match"
End If
Next x

End Sub

Hope that helps.

Best regards

John
 
From comp.apps.spreadsheets on Jan 26, 2001 by Loren Anderson...
Given 2 lists of words
1. Select column B (click the letter B)
2. Choose Format > Conditional formatting
3. In ""Condition 1"" choose ""Formula is""
4. Enter this formula =(COUNTIF($A:$A,B1)=0)*(B1<>"")
5. Click the ""Formats"" button and take your pick. OK.OK.
Now every name in B not in A will light up.
--
Jim Cone
San Francisco, USA
http://www.realezsites.com/bus/primitivesoftware



"David Kennedy" <[email protected]>
wrote in message
Hi,
Can anyone show me how to find differences between two columns ie..
Col A Col B
100 100
106 108
2500 2500
2999 2999

106 is not in Col B and 108 is not in Col A.
can it be done using a function? ,could you also show me code to do this?
Thanks in advance ,
David
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top