excel - Match Any Word Inside Cell With Any Word In Range of Cells -
i have list of phrases. check if new terms match list partially word.
i'm looking code implement fuzzy matching on list return cell has close match.
example data:
phrases,terms real term,new words great work,new term check phrase,more phrase example here,great alpha phrase random,beta new
desired output:
phrases,term,match real term,new words,no match great work,new term,real term check phrase,more phrase,check phrase/phrase random example here,great alpha,great work phrase random,beta new,no match
what i've got:
i tried using following code match cell if found:
=if(iserror(match("*" & b2 & "*",a:a, 0)), "no match", vlookup("*" & b2 & "*",a:a,1,false))
however, code matches entire cell. how can make match word in cell? create fuzzy match. positive input highly appreciated.
here (rough , ready) vba solution question. need insert code module in vba editor , can run macro desired output
sub findsimilar() dim phrases range, phrase range dim terms range, term range dim matches string dim words() string 'ensure has correct sheet names workbook set phrases = thisworkbook.worksheets("sheet2").range("a2:a6") set terms = thisworkbook.worksheets("sheet1").range("d2:d6") each term in terms matches = "" words() = split(term.value) = 0 ubound(words, 1) each phrase in phrases if instr(1, phrase.value, words(i)) matches = matches & phrase & "/" end if next phrase next if matches <> vbnullstring term.offset(0, 5).value = left(matches, len(matches) - 1) else term.offset(0, 5).value = "no match" end if next term end sub
Comments
Post a Comment