[B][COLOR=Royalblue]Sub[/COLOR][/B] a1075525b[B]()[/B]
[I][COLOR=seagreen]'https://www.mrexcel.com/forum/excel-questions/1075525-match-positive-numeric-value-negative.html[/COLOR][/I]
[B][COLOR=Royalblue]Dim[/COLOR][/B] i [B][COLOR=Royalblue]As[/COLOR][/B] [B][COLOR=Royalblue]Long[/COLOR][/B][B],[/B] z [B][COLOR=Royalblue]As[/COLOR][/B] [B][COLOR=Royalblue]Long[/COLOR][/B]
[B][COLOR=Royalblue]Dim[/COLOR][/B] rng [B][COLOR=Royalblue]As[/COLOR][/B] Range
[B][COLOR=Royalblue]Dim[/COLOR][/B] m [B][COLOR=Royalblue]As[/COLOR][/B] [B][COLOR=Royalblue]String[/COLOR][/B]
[B][COLOR=Royalblue]Dim[/COLOR][/B] va [B][COLOR=Royalblue]As[/COLOR][/B] [B][COLOR=Royalblue]Variant[/COLOR][/B]
[B][COLOR=Royalblue]Dim[/COLOR][/B] d [B][COLOR=Royalblue]As[/COLOR][/B] [B][COLOR=Royalblue]Object[/COLOR][/B]
Application.ScreenUpdating [B]=[/B] [B][COLOR=Royalblue]False[/COLOR][/B]
[B][COLOR=Royalblue]Set[/COLOR][/B] rng [B]=[/B] Range[B]([/B][COLOR=brown]"N1"[/COLOR][B],[/B] Cells[B]([/B]Rows.count[B],[/B] [COLOR=brown]"N"[/COLOR][B]).[/B][B][COLOR=Royalblue]End[/COLOR][/B][B]([/B]xlUp[B]))[/B]
va [B]=[/B] rng
[B][COLOR=Royalblue]Set[/COLOR][/B] d [B]=[/B] CreateObject[B]([/B][COLOR=brown]"scripting.dictionary"[/COLOR][B])[/B]
[B][COLOR=Royalblue]For[/COLOR][/B] i [B]=[/B] [B][COLOR=crimson]2[/COLOR][/B] [B][COLOR=Royalblue]To[/COLOR][/B] UBound[B]([/B]va[B],[/B] [B][COLOR=crimson]1[/COLOR][/B][B])[/B]
z [B]=[/B] va[B]([/B]i[B],[/B] [B][COLOR=crimson]1[/COLOR][/B][B])[/B]
[B][COLOR=Royalblue]If[/COLOR][/B] d.Exists[B]([/B]z[B])[/B] [B][COLOR=Royalblue]Then[/COLOR][/B]
d[B]([/B]z[B])[/B] [B]=[/B] d[B]([/B]z[B])[/B] [B]&[/B] [COLOR=brown]","[/COLOR] [B]&[/B] i
[B][COLOR=Royalblue]ElseIf[/COLOR][/B] d.Exists[B](-[/B]z[B])[/B] [B][COLOR=Royalblue]Then[/COLOR][/B]
s [B]=[/B] Split[B]([/B]d[B](-[/B]z[B]),[/B] [COLOR=brown]","[/COLOR][B])[/B]
m [B]=[/B] s[B]([/B]UBound[B]([/B]s[B]))[/B]
va[B]([/B]i[B],[/B] [B][COLOR=crimson]1[/COLOR][/B][B])[/B] [B]=[/B] va[B]([/B]i[B],[/B] [B][COLOR=crimson]1[/COLOR][/B][B])[/B] [B]&[/B] [COLOR=brown]"#"[/COLOR]
va[B]([/B]m[B],[/B] [B][COLOR=crimson]1[/COLOR][/B][B])[/B] [B]=[/B] va[B]([/B]m[B],[/B] [B][COLOR=crimson]1[/COLOR][/B][B])[/B] [B]&[/B] [COLOR=brown]"#"[/COLOR]
[B][COLOR=Royalblue]If[/COLOR][/B] UBound[B]([/B]s[B])[/B] [B]=[/B] [B][COLOR=crimson]0[/COLOR][/B] [B][COLOR=Royalblue]Then[/COLOR][/B]
d.Remove [B]-[/B]z
[B][COLOR=Royalblue]Else[/COLOR][/B]
d[B](-[/B]z[B])[/B] [B]=[/B] Left[B]([/B]d[B](-[/B]z[B]),[/B] Len[B]([/B]d[B](-[/B]z[B]))[/B] [B]-[/B] Len[B]([/B]m[B])[/B] [B]-[/B] [B][COLOR=crimson]1[/COLOR][/B][B])[/B]
[B][COLOR=Royalblue]End[/COLOR][/B] [B][COLOR=Royalblue]If[/COLOR][/B]
[B][COLOR=Royalblue]Else[/COLOR][/B]
d[B]([/B]z[B])[/B] [B]=[/B] i
[B][COLOR=Royalblue]End[/COLOR][/B] [B][COLOR=Royalblue]If[/COLOR][/B]
[B][COLOR=Royalblue]Next[/COLOR][/B]
rng [B]=[/B] va
Application.ReplaceFormat.Interior.Color [B]=[/B] vbYellow
rng.Replace What[B]:=[/B][COLOR=brown]"#"[/COLOR][B],[/B] Replacement[B]:=[/B][COLOR=brown]""[/COLOR][B],[/B] _
LookAt[B]:=[/B]xlPart[B],[/B] SearchOrder[B]:=[/B]xlByRows[B],[/B] MatchCase[B]:=[/B][B][COLOR=Royalblue]True[/COLOR][/B][B],[/B] _
SearchFormat[B]:=[/B][B][COLOR=Royalblue]False[/COLOR][/B][B],[/B] ReplaceFormat[B]:=[/B][B][COLOR=Royalblue]True[/COLOR][/B]
rng.Replace What[B]:=[/B][COLOR=brown]"#"[/COLOR][B],[/B] Replacement[B]:=[/B][COLOR=brown]""[/COLOR][B],[/B] _
LookAt[B]:=[/B]xlPart[B],[/B] SearchOrder[B]:=[/B]xlByRows[B],[/B] MatchCase[B]:=[/B][B][COLOR=Royalblue]True[/COLOR][/B][B],[/B] _
SearchFormat[B]:=[/B][B][COLOR=Royalblue]False[/COLOR][/B][B],[/B] ReplaceFormat[B]:=[/B][B][COLOR=Royalblue]False[/COLOR][/B]
Application.ScreenUpdating [B]=[/B] [B][COLOR=Royalblue]True[/COLOR][/B]
[B][COLOR=Royalblue]End[/COLOR][/B] [B][COLOR=Royalblue]Sub[/COLOR][/B]