View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Datasort Datasort is offline
external usenet poster
 
Posts: 50
Default how do i compare 2 cells and extract the text that is different?

I have a solution if the changed characters are in the same place or you are
looking for the first character that is changed in a cell.


Function FindDif (strFirst as string, strSecond as string) as string


Dim iLoopChar as integer, bFoundDif as boolean

For iLoopChar = 1 to len(strFirst)
If mid (strFirst,iloopchar,1) < mid (strSecond,iloopchar,1) then
bFoundDif = true
Exit for
End if
Next iLoopChar

If bFoundDif then

FindDif = mid (strFirst,iloopchar,1)

Else
FindDif = €œN/A€

End if


exit Funciton


Good luck

--
Stewart Rogers
DataSort Software, L.C.


"ky1234" wrote:

I have 2 columns that contain text that is different, but almost matches
except for 1 character that does not. i want to find out what is the
character in the cell that does NOT match.
ie.
column a = APTK745 (i want to return the P)
column b = ARTK745 (i want to return the R)
or
column a = ANPF841 (i want to return the F)
column b = ANPE841 (i want to return the E)