Hi I'm trying to compare 2 strings of characters and have the result be the difference only. eg 37ArnsideStreetRusholmeOL145PH 37ArnsideStreetRusholmeManchesterOL145PH Result: Manchester I've tried using the Worddif VBA function but as my data has no spaces the result is the entire string. Is it possible to compare at character level? I've included the worddif details below. Thanks in advance! Function WORDDIF(rngA As Range, rngB As Range) As String Dim WordsA As Variant, WordsB As Variant Dim ndxA As Long, ndxB As Long, strTemp As String WordsA = Split(rngA.Text, " ") WordsB = Split(rngB.Text, " ") For ndxB = LBound(WordsB) To UBound(WordsB) For ndxA = LBound(WordsA) To UBound(WordsA) If StrComp(WordsA(ndxA), WordsB(ndxB), vbTextCompare) = 0 Then WordsA(ndxA) = vbNullString
This question generated 10 answers. To proceed to the answers, click here.
This thread is current as of November 27, 2014.
For more resources for Microsoft Excel:
This article includes the following tags:
- Microsoft Excel