Thanks:  0
Likes:  0

1. Friends:
List A = 1000 serial numbers eg. 75TCB11
List B = 100 serial numbers

Task: To find List B numbers wherever located in List A.

Solution: ?? A macro maybe, or other?

Help

2. Try the following code:

Sub AlignCols()
'XXXXXXXXXXXXline1XXXXXXXXXXXX
Dim LastBRow, i, IndexNum As Long
'XXXXXXXXXXXXline2XXXXXXXXXXXX
LastBRow = Range(Range("B1"), Range("B1").End(xlDown)).Rows.Count
'XXXXXXXXXXXXline3XXXXXXXXXXXX
For i = LastBRow To 2 Step -1
'XXXXXXXXXXXXline4XXXXXXXXXXXX
IndexNum = Application.WorksheetFunction.Match(Range("B" & i), Columns("A"), 0)
'XXXXXXXXXXXXline5XXXXXXXXXXXX
Range("B" & i).Select
'XXXXXXXXXXXXline6XXXXXXXXXXXX
Selection.Cut Destination:=Cells(IndexNum, 2)
'XXXXXXXXXXXXline7XXXXXXXXXXXX
Next
End Sub

I wrote this code for someone yesterday. Just make sure that the two lists are sorted.

3. =COUNTIF(C1..C100,A1)

This assumes you aren't after the location of a match, just whether or not the item appears on the other list.

If your List A is cells A1..A1000, this formula goes in B1..B1000.

COUNTIF will return 1 if the item in A1 appears anywhere in List B, 0 if it does not.

To make it visually easier, enlcose that formula in an IF statement:

=IF(COUNTIF(C1..C100,A1),"YES","")

1 is another way of saying TRUE, 0 another way of saying FALSE, so this one will show YES for a match and formula generated blank for a non-match.

## User Tag List

#### Posting Permissions

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