[FONT=lucida console][color=Royalblue]Sub[/color] positive_negative_match1c()
[i][color=seagreen]'use this[/color][/i]
[i][color=seagreen]'positive-negative match pair[/color][/i]
[i][color=seagreen]'without grouping[/color][/i]
[color=Royalblue]Dim[/color] i [color=Royalblue]As[/color] [color=Royalblue]Long[/color]
[color=Royalblue]Dim[/color] va, z, q, ary1, ary2
[color=Royalblue]Dim[/color] d [color=Royalblue]As[/color] [color=Royalblue]Object[/color]
[i][color=seagreen]'data start at Q2[/color][/i]
va = Range([color=brown]"Q2"[/color], Cells(Rows.count, [color=brown]"Q"[/color]).[color=Royalblue]End[/color](xlUp))
[color=Royalblue]Set[/color] d = CreateObject([color=brown]"scripting.dictionary"[/color])
[color=Royalblue]For[/color] i = [color=crimson]1[/color] [color=Royalblue]To[/color] UBound(va, [color=crimson]1[/color])
z = va(i, [color=crimson]1[/color]): d(z) = d(z) & [color=brown]","[/color] & i
[color=Royalblue]Next[/color]
[color=Royalblue]For[/color] [color=Royalblue]Each[/color] q [color=Royalblue]In[/color] d.Keys
[color=Royalblue]If[/color] q > [color=crimson]0[/color] [color=Royalblue]And[/color] d.Exists(-q) [color=Royalblue]Then[/color]
ary1 = Split(d(q), [color=brown]","[/color]): ary2 = Split(d(-q), [color=brown]","[/color])
[color=Royalblue]If[/color] UBound(ary1) < UBound(ary2) [color=Royalblue]Then[/color] P = UBound(ary1) [color=Royalblue]Else[/color] P = UBound(ary2)
[color=Royalblue]For[/color] i = [color=crimson]1[/color] [color=Royalblue]To[/color] P
va(ary1(i), [color=crimson]1[/color]) = [color=brown]"xx"[/color]: va(ary2(i), [color=crimson]1[/color]) = [color=brown]"xx"[/color]
[color=Royalblue]Next[/color]
[color=Royalblue]End[/color] [color=Royalblue]If[/color]
[color=Royalblue]Next[/color]
[i][color=seagreen]'put the result in col R[/color][/i]
Range([color=brown]"R2"[/color]).Resize(UBound(va, [color=crimson]1[/color]), [color=crimson]1[/color]) = va
[color=Royalblue]End[/color] [color=Royalblue]Sub[/color][/FONT]