Como posso mostrar a diferença de string (Elementary)?
Here's a custom function called
WORDDIF
that may do what you want.To install the custom function...
- Alt+F11 to open the VBA Editor
- From the VBA menu, select Insert > Module
- Paste the code below in the VBA Edit window
Back in Excel, put this formula in C1
=WORDDIF(A1,B1)
Code:
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 Exit For End If Next ndxA Next ndxB For ndxA = LBound(WordsA) To UBound(WordsA) If WordsA(ndxA) <> vbNullString Then strTemp = strTemp & WordsA(ndxA) & " " Next ndxA WORDDIF = Trim(strTemp) End Function
Fonte link