excel - Find duplicate text in a string and remove it -
i have excel problem. trying find matching text between 2 columns , remove matched text. example
column 1:
john romeo
column 2:
john romeo 16 smith street
results:
16 smith street
the results column text want.
here's custom function called worddif may want.
to install custom function in windows ... alt+f11 open vba editor vba menu, select insert -> module
to install custom function in os x ... go tools -> macro -> visual basic editor vba menu, select insert -> module
paste code below in vba edit window
back in excel, copy formula results column:
results=worddif(column1cell1, column2cell2)
function worddif(rnga range, rngb range) string dim wordsa variant, wordsb variant dim ndxa long, ndxb long, strtemp string wordsa = split(rnga.text, " ") wordsb = split(rngb.text, " ") ndxb = lbound(wordsb) ubound(wordsb) ndxa = lbound(wordsa) ubound(wordsa) if strcomp(wordsa(ndxa), wordsb(ndxb), vbtextcompare) = 0 wordsa(ndxa) = vbnullstring exit end if next ndxa next ndxb ndxa = lbound(wordsa) ubound(wordsa) if wordsa(ndxa) <> vbnullstring strtemp = strtemp & wordsa(ndxa) & " " next ndxa worddif = trim(strtemp) end function
for attribution, solution http://www.mrexcel.com/forum/excel-questions/486708-compare-two-strings-find-difference.html
Comments
Post a Comment