View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
David Billigmeier David Billigmeier is offline
external usenet poster
 
Posts: 176
Default Compare two strings

This one will work... it's a long one. It will output the position of the
last 2 characters that match. It assumes the "first" string is in A1 and the
"second" is in A2. To finally get the percentage value divide the whole
thing by LEN(A1). Also, make sure to commit it with CTRL+SHIFT+ENTER:

=MAX(ROW(INDIRECT("1:"&MAX(LEN(A1),LEN(A2))))*(MID (A1,ROW(INDIRECT("1:"&MAX(LEN(A1),LEN(A2)))),1)=MI D(A2,ROW(INDIRECT("1:"&MAX(LEN(A1),LEN(A2)))),1)))

--
Regards,
Dave


"andy62" wrote:

I am wondering if there is any trick for identifying how much of a match two
text strings are? In my case, the two strings would start the same, but then
differ somewhere in the middle or the end. If I could identify the character
position where the difference occurs that would help me - and then maybe
divide that number by the length in characters of the first string to get a
percentage.

TIA