Script/function to extract duplicate entries between two columns?

  • Thread starter Thread starter Jim Witte
  • Start date Start date
J

Jim Witte

I have a spreadsheet set up like this

<username1> <real name2> <username2> <real name2>
..

I want a way to extract all lines in series <username1> that are
somewhere in <username2> or, converly, are NOT in that series. Actually,
I want to extract both <username1> and <real name1> as one datum, but
that shouldn't be hard.

Is there a thouroughly easy way to do this with a macro (meaning under
4 lines), or should I just import that data into Runtime Revolution,
where I can write a 4 line script to do it.. (but the formating of the
data would take longer..)

Jim
 
set cell = Range("A2")
do while not isempty(cell)
res = Application.Match(cell,Columns(3),0)
if not iserror(res) then
cell.Resize(1,2),Copy Destination:=Cells(rows.count,5).end(xlup)(2)
End if
Set cell = cell.offset(1,0)
Loop

remove the "not" to copy non-matches.

or in D2

=if(Countif(C:C,A2)>0,A2,"")

and drag fill down the column.
 
Back
Top