Solved: excel 2003 column difference

Status
This thread has been Locked and is not open to further replies. Please start a New Thread if you're having a similar issue. View our Welcome Guide to learn how to use this site.

drafter

I am using excel 2003 and I would like to compare to columns of numbers with each other and have third column produce the difference between the two. For example if the first column had 1, 2, 3, 4 and the second column had 3, 4, 5, 6 the third colums would have 1, 2, 5, 6. These are the numbers that ARE NOT common to each other. Hope I didn't make this more confusing than it is. Can anyone help me with this?

thanx

bomb #21

You could try a macro to loop through each list in turn (like the following, which assumes that the lists start in A1 and B1 respectively):

Sub Macro1()
For Each Cell In Range("A1", Range("A65536").End(xlUp))
If WorksheetFunction.CountIf(Range("B:B"), Cell) = 0 Then
x = WorksheetFunction.CountA(Range("C:C"))
Cell.Copy Range("C1").Offset(x, 0)
Else
End If
Next Cell
For Each Cell In Range("B1", Range("B65536").End(xlUp))
If WorksheetFunction.CountIf(Range("A:A"), Cell) = 0 Then
x = WorksheetFunction.CountA(Range("C:C"))
Cell.Copy Range("C1").Offset(x, 0)
Else
End If
Next Cell
End Sub

drafter

that macro seems to get stuck on the following line.

x = WorksheetFunction.CountA(Range("D"))

Zack Barresse

Can you zip/upload a sample file, which also shows the desired results?

bomb #21

drafter said:
that macro seems to get stuck on the following line.

x = WorksheetFunction.CountA(Range("D"))
I edited the original post (damn smilies), we may have crossed over. Try again?

drafter

worked great bomb 21.

thanx

bomb #21

drafter said:
worked great bomb 21.

thanx
No worries -- have a good one.

Status
This thread has been Locked and is not open to further replies. Please start a New Thread if you're having a similar issue. View our Welcome Guide to learn how to use this site.

As Seen On