MrExcel Publishing
Your One Stop for Excel Tips & Solutions

comparing two lists, finding the discrepancies

Posted by Keith Mueller on September 20, 2000 12:21 PM

I am trying something that should be simple. I have two lists of 9 digit ID numbers. I need to compare the lists and see which ones are not showing up on the other list.

Excel help files and microsoft's web site have been useless.

Any ideas?


Posted by Celia on September 21, 0100 1:15 AM

Or if you prefer a worksheet formula method, have a look at :-

which provides the following stucture for the formula :-


Posted by David on September 20, 0100 11:05 PM

Excel help files and microsoft's web site have been useless. Any ideas?

Substitute a1 for the top of the list
and the workbook names and sheet names but it is a beginning. If you think it might work and can't figure it out give more detail.

Sub Macro1()

For x = 1 To Workbooks("workbook2.xls").Sheets(1).Range("A1").End(xlDown).Row
For y = 1 To Workbooks("workbook1.xls").Sheets(1).Range("A1").End(xlDown).Row
If Workbooks("workbook2.xls").Sheets(1).Cells(x, 1) = Workbooks("workbook1.xls").Sheets(1).Cells(y, 1) Then
found = True
y = Workbooks("workbook1.xls").Sheets(1).Range("A1").End(xlDown).Row + 1
End If
Next y
If found = False Then
Workbooks("workbook2.xls").Sheets(1).Cells(x, 1).Font.ColorIndex = 3
Workbooks("workbook2.xls").Sheets(1).Cells(x, 1).Font.Italic = True
End If
found = False

Next x

End Sub