Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 48
Default Comparing text?

I asked this question in a roundabout way last week with no success.

Basically, is it possible to compare text of one cell to another cell
to produce a % of correctness. It doesn't have to be exact as I am
only using it to set up a French revision spreadsheet.

I know it's a tricky one but any help would be great. Over to the
experts!

Thanks

Tony

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 78
Default Comparing text?

Hi, yes it is possible. You can do the following,
1. Find the number of characters in one cell and assume that it is 100%
2. Check character-by-character the exactness of characters in both the
cells and count the match
3. Calculate % from the count of matched characters

" wrote:

I asked this question in a roundabout way last week with no success.

Basically, is it possible to compare text of one cell to another cell
to produce a % of correctness. It doesn't have to be exact as I am
only using it to set up a French revision spreadsheet.

I know it's a tricky one but any help would be great. Over to the
experts!

Thanks

Tony


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 48
Default Comparing text?

On Feb 19, 11:38 am, Madhan wrote:
Hi, yes it is possible. You can do the following,
1. Find the number of characters in one cell and assume that it is 100%
2. Check character-by-character the exactness of characters in both the
cells and count the match
3. Calculate % from the count of matched characters



" wrote:
I asked this question in a roundabout way last week with no success.


Basically, is it possible to compare text of one cell to another cell
to produce a % of correctness. It doesn't have to be exact as I am
only using it to set up a French revision spreadsheet.


I know it's a tricky one but any help would be great. Over to the
experts!


Thanks


Tony- Hide quoted text -


- Show quoted text -


Thanks Madhan,
To be honest I am not sure how to do this and wouldn't know where to
start (my Excel knowledge is very limited) - can you help?

Thanks
Tony


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 78
Default Comparing text?

Hi, please find below a sample code. I hope it helps you. Try entering in A1
the main text and in A2 the text to be compared. Call myCompare from a macro.

Const ROW_MAIN As Integer = 1
Const ROW_OTHER As Integer = 2
Const ROW_RESULT As Integer = 3
'
Sub myCompare()

Dim str1, str2 As String
Dim tCell As Range

' GET THE TEXTS TO BE COMPARED
Set tCell = Cells(ROW_MAIN, 1)
str1 = Trim(tCell.Value)
Set tCell = Cells(ROW_OTHER, 1)
str2 = Trim(tCell.Value)
Set tCell = Nothing
' PERFORM CHAR-BY-CHAR COMPARISON AND COUNT MATCHES
Dim size1, size2, size3 As Long
Dim half, oneThird, percent1, percent2, percent3 As Double
Dim per, status, err_msg As String

size1 = Len(str1)
size2 = Len(str2)
err_msg = ""
' CHECK IF ANY TEXT IS EMPTY
If Not size1 = 0 And size2 = 0 Then

err_msg = "Please enter a text for comparison in row " & ROW_OTHER
GoTo prn_abnorm_result
End If
If size1 = 0 And Not size2 = 0 Then

err_msg = "Please enter a text for comparison in row " & ROW_MAIN
GoTo prn_abnorm_result
End If
If size1 = 0 And size2 = 0 Then

err_msg = "Please enter some text for comparison in rows " & ROW_MAIN & "
and " & ROW_OTHER
GoTo prn_abnorm_result
End If
' CHECK IF SIZES DO NOT MATCH
status = ""
per = "by 100"
If Not size1 = size2 Then

status = "not "
oneThird = size1 / 4
half = size1 / 2
If size2 = oneThird And size2 <= half Then
per = "between 50 and 75"
GoTo prn_norm_result
End If
If size2 < oneThird Then
per = "by more-than 75"
GoTo prn_norm_result
End If
If size2 size1 Then
per = "by more-than 100"
GoTo prn_norm_result
End If
End If
percent1 = Round(size1 / 100, 2)
size3 = countMismatch(str1, str2)
status = "not "
per = "by 100"
If Not size3 = 0 Then

If Not size3 = size1 Then

percent2 = Round(Abs(size2 - size3) / 100, 2)
percent3 = Round((percent2 / percent1) * 100, 2)
If percent3 = 50# Then status = "" Else status = "not "
per = "by " & percent3
End If
End If
prn_norm_result:
' PRINT NORMAL RESULT
showMsg "RESULT : Text in second row does " & status & "match that in first
row, " & per & " %"
GoTo end_of_sub
prn_abnorm_result:
showMsg "ERROR : " & err_msg
end_of_sub:
End Sub
'
Function countMismatch(ByVal argStr1 As String, ByVal argStr2 As String) As
Integer
Dim i, size As Long
Dim val As Integer

size = Len(argStr1)
val = 0
For i = 1 To size

If Not Mid(argStr1, i, 1) = Mid(argStr2, i, 1) Then val = val + 1
Next i
countMismatch = val
End Function
'
Sub showMsg(ByVal argMsg As String)
Dim tCell As Range
Dim col As Integer

If Left(argMsg, 3) = "ERR" Then col = 255 Else col = 0
Set tCell = Cells(ROW_RESULT, 1)
With tCell
.Value = argMsg
.Font.Bold = True
.Font.Color = RGB(col, 0, 0)
End With
Set tCell = Nothing
End Sub


" wrote:

On Feb 19, 11:38 am, Madhan wrote:
Hi, yes it is possible. You can do the following,
1. Find the number of characters in one cell and assume that it is 100%
2. Check character-by-character the exactness of characters in both the
cells and count the match
3. Calculate % from the count of matched characters



" wrote:
I asked this question in a roundabout way last week with no success.


Basically, is it possible to compare text of one cell to another cell
to produce a % of correctness. It doesn't have to be exact as I am
only using it to set up a French revision spreadsheet.


I know it's a tricky one but any help would be great. Over to the
experts!


Thanks


Tony- Hide quoted text -


- Show quoted text -


Thanks Madhan,
To be honest I am not sure how to do this and wouldn't know where to
start (my Excel knowledge is very limited) - can you help?

Thanks
Tony



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 78
Default Comparing text?

Hi, please ignore the previous code. Please use the following.

Const ROW_MAIN As Integer = 1
Const ROW_OTHER As Integer = 2
Const ROW_RESULT As Integer = 3
'
Sub myCompare()

Dim str1, str2 As String
Dim tCell As Range

' GET THE TEXTS TO BE COMPARED
Set tCell = Cells(ROW_MAIN, 1)
str1 = Trim(tCell.Value)
Set tCell = Cells(ROW_OTHER, 1)
str2 = Trim(tCell.Value)
Set tCell = Nothing
' PERFORM CHAR-BY-CHAR COMPARISON AND COUNT MATCHES
Dim size1, size2, size3 As Long
Dim half, oneThird, percent1, percent2, percent3 As Double
Dim per, status, err_msg As String

size1 = Len(str1)
size2 = Len(str2)
err_msg = ""
' CHECK IF ANY TEXT IS EMPTY
If Not size1 = 0 And size2 = 0 Then

err_msg = "Please enter a text for comparison in row " & ROW_OTHER
GoTo prn_abnorm_result
ElseIf size1 = 0 And Not size2 = 0 Then

err_msg = "Please enter a text for comparison in row " & ROW_MAIN
GoTo prn_abnorm_result
ElseIf size1 = 0 And size2 = 0 Then

err_msg = "Please enter some text for comparison in rows " & ROW_MAIN & "
and " & ROW_OTHER
GoTo prn_abnorm_result
ElseIf size1 < size2 Then

err_msg = "Text to be compared is longer than the original text"
GoTo prn_abnorm_result
ElseIf size1 size2 Then

err_msg = "Text to be compared is shorter than the original text"
GoTo prn_abnorm_result
End If
size3 = countMismatch(str1, str2)
If size3 = 0 Then

showMsg "RESULT : Matches 100%"
GoTo end_of_sub
ElseIf size3 = size1 Then

showMsg "RESULT : Mismatches 100%"
GoTo end_of_sub
Else

status = "not "
per = "by "
percent1 = Round(size1 / 100, 2)
percent2 = Round(Abs(size2 - size3) / 100, 2)
percent3 = Round((percent2 / percent1) * 100, 2)
per = per & percent3
If (size3 < Round(size1 / 2, 2) And percent3 = 50#) Or (size3
Round(size1 / 2, 2) And percent3 < 50#) Then status = ""
End If
prn_norm_result:
' PRINT NORMAL RESULT
showMsg "RESULT : Text in second row does " & status & "match that in first
row, " & per & " %"
GoTo end_of_sub
prn_abnorm_result:
showMsg "ERROR : " & err_msg
end_of_sub:
End Sub
'
Function countMismatch(ByVal argStr1 As String, ByVal argStr2 As String) As
Integer
Dim i, size As Long
Dim val As Integer

size = Len(argStr1)
val = 0
For i = 1 To size

If Not Mid(argStr1, i, 1) = Mid(argStr2, i, 1) Then val = val + 1
Next i
countMismatch = val
End Function
'
Sub showMsg(ByVal argMsg As String)
Dim tCell As Range
Dim col As Integer

If Left(argMsg, 3) = "ERR" Then col = 255 Else col = 0
Set tCell = Cells(ROW_RESULT, 1)
With tCell
.Value = argMsg
.Font.Bold = True
.Font.Color = RGB(col, 0, 0)
End With
End Sub


"Madhan" wrote:

Hi, please find below a sample code. I hope it helps you. Try entering in A1
the main text and in A2 the text to be compared. Call myCompare from a macro.

Const ROW_MAIN As Integer = 1
Const ROW_OTHER As Integer = 2
Const ROW_RESULT As Integer = 3
'
Sub myCompare()

Dim str1, str2 As String
Dim tCell As Range

' GET THE TEXTS TO BE COMPARED
Set tCell = Cells(ROW_MAIN, 1)
str1 = Trim(tCell.Value)
Set tCell = Cells(ROW_OTHER, 1)
str2 = Trim(tCell.Value)
Set tCell = Nothing
' PERFORM CHAR-BY-CHAR COMPARISON AND COUNT MATCHES
Dim size1, size2, size3 As Long
Dim half, oneThird, percent1, percent2, percent3 As Double
Dim per, status, err_msg As String

size1 = Len(str1)
size2 = Len(str2)
err_msg = ""
' CHECK IF ANY TEXT IS EMPTY
If Not size1 = 0 And size2 = 0 Then

err_msg = "Please enter a text for comparison in row " & ROW_OTHER
GoTo prn_abnorm_result
End If
If size1 = 0 And Not size2 = 0 Then

err_msg = "Please enter a text for comparison in row " & ROW_MAIN
GoTo prn_abnorm_result
End If
If size1 = 0 And size2 = 0 Then

err_msg = "Please enter some text for comparison in rows " & ROW_MAIN & "
and " & ROW_OTHER
GoTo prn_abnorm_result
End If
' CHECK IF SIZES DO NOT MATCH
status = ""
per = "by 100"
If Not size1 = size2 Then

status = "not "
oneThird = size1 / 4
half = size1 / 2
If size2 = oneThird And size2 <= half Then
per = "between 50 and 75"
GoTo prn_norm_result
End If
If size2 < oneThird Then
per = "by more-than 75"
GoTo prn_norm_result
End If
If size2 size1 Then
per = "by more-than 100"
GoTo prn_norm_result
End If
End If
percent1 = Round(size1 / 100, 2)
size3 = countMismatch(str1, str2)
status = "not "
per = "by 100"
If Not size3 = 0 Then

If Not size3 = size1 Then

percent2 = Round(Abs(size2 - size3) / 100, 2)
percent3 = Round((percent2 / percent1) * 100, 2)
If percent3 = 50# Then status = "" Else status = "not "
per = "by " & percent3
End If
End If
prn_norm_result:
' PRINT NORMAL RESULT
showMsg "RESULT : Text in second row does " & status & "match that in first
row, " & per & " %"
GoTo end_of_sub
prn_abnorm_result:
showMsg "ERROR : " & err_msg
end_of_sub:
End Sub
'
Function countMismatch(ByVal argStr1 As String, ByVal argStr2 As String) As
Integer
Dim i, size As Long
Dim val As Integer

size = Len(argStr1)
val = 0
For i = 1 To size

If Not Mid(argStr1, i, 1) = Mid(argStr2, i, 1) Then val = val + 1
Next i
countMismatch = val
End Function
'
Sub showMsg(ByVal argMsg As String)
Dim tCell As Range
Dim col As Integer

If Left(argMsg, 3) = "ERR" Then col = 255 Else col = 0
Set tCell = Cells(ROW_RESULT, 1)
With tCell
.Value = argMsg
.Font.Bold = True
.Font.Color = RGB(col, 0, 0)
End With
Set tCell = Nothing
End Sub


" wrote:

On Feb 19, 11:38 am, Madhan wrote:
Hi, yes it is possible. You can do the following,
1. Find the number of characters in one cell and assume that it is 100%
2. Check character-by-character the exactness of characters in both the
cells and count the match
3. Calculate % from the count of matched characters



" wrote:
I asked this question in a roundabout way last week with no success.

Basically, is it possible to compare text of one cell to another cell
to produce a % of correctness. It doesn't have to be exact as I am
only using it to set up a French revision spreadsheet.

I know it's a tricky one but any help would be great. Over to the
experts!

Thanks

Tony- Hide quoted text -

- Show quoted text -


Thanks Madhan,
To be honest I am not sure how to do this and wouldn't know where to
start (my Excel knowledge is very limited) - can you help?

Thanks
Tony





  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default Comparing text?

Why do you say no success. I answered your question with a good reference to
code that will do it.


--
Regards,
Tom Ogilvy


" wrote:

On Feb 19, 11:38 am, Madhan wrote:
Hi, yes it is possible. You can do the following,
1. Find the number of characters in one cell and assume that it is 100%
2. Check character-by-character the exactness of characters in both the
cells and count the match
3. Calculate % from the count of matched characters



" wrote:
I asked this question in a roundabout way last week with no success.


Basically, is it possible to compare text of one cell to another cell
to produce a % of correctness. It doesn't have to be exact as I am
only using it to set up a French revision spreadsheet.


I know it's a tricky one but any help would be great. Over to the
experts!


Thanks


Tony- Hide quoted text -


- Show quoted text -


Thanks Madhan,
To be honest I am not sure how to do this and wouldn't know where to
start (my Excel knowledge is very limited) - can you help?

Thanks
Tony



  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 48
Default Comparing text?

On Feb 19, 3:05 pm, Madhan wrote:
Hi, please ignore the previous code. Please use the following.

Const ROW_MAIN As Integer = 1
Const ROW_OTHER As Integer = 2
Const ROW_RESULT As Integer = 3
'
Sub myCompare()

Dim str1, str2 As String
Dim tCell As Range

' GET THE TEXTS TO BE COMPARED
Set tCell = Cells(ROW_MAIN, 1)
str1 = Trim(tCell.Value)
Set tCell = Cells(ROW_OTHER, 1)
str2 = Trim(tCell.Value)
Set tCell = Nothing
' PERFORM CHAR-BY-CHAR COMPARISON AND COUNT MATCHES
Dim size1, size2, size3 As Long
Dim half, oneThird, percent1, percent2, percent3 As Double
Dim per, status, err_msg As String

size1 = Len(str1)
size2 = Len(str2)
err_msg = ""
' CHECK IF ANY TEXT IS EMPTY
If Not size1 = 0 And size2 = 0 Then

err_msg = "Please enter a text for comparison in row " & ROW_OTHER
GoTo prn_abnorm_result
ElseIf size1 = 0 And Not size2 = 0 Then

err_msg = "Please enter a text for comparison in row " & ROW_MAIN
GoTo prn_abnorm_result
ElseIf size1 = 0 And size2 = 0 Then

err_msg = "Please enter some text for comparison in rows " & ROW_MAIN & "
and " & ROW_OTHER
GoTo prn_abnorm_result
ElseIf size1 < size2 Then

err_msg = "Text to be compared is longer than the original text"
GoTo prn_abnorm_result
ElseIf size1 size2 Then

err_msg = "Text to be compared is shorter than the original text"
GoTo prn_abnorm_result
End If
size3 = countMismatch(str1, str2)
If size3 = 0 Then

showMsg "RESULT : Matches 100%"
GoTo end_of_sub
ElseIf size3 = size1 Then

showMsg "RESULT : Mismatches 100%"
GoTo end_of_sub
Else

status = "not "
per = "by "
percent1 = Round(size1 / 100, 2)
percent2 = Round(Abs(size2 - size3) / 100, 2)
percent3 = Round((percent2 / percent1) * 100, 2)
per = per & percent3
If (size3 < Round(size1 / 2, 2) And percent3 = 50#) Or (size3
Round(size1 / 2, 2) And percent3 < 50#) Then status = ""
End If
prn_norm_result:
' PRINT NORMAL RESULT
showMsg "RESULT : Text in second row does " & status & "match that in first
row, " & per & " %"
GoTo end_of_sub
prn_abnorm_result:
showMsg "ERROR : " & err_msg
end_of_sub:
End Sub
'
Function countMismatch(ByVal argStr1 As String, ByVal argStr2 As String) As
Integer
Dim i, size As Long
Dim val As Integer

size = Len(argStr1)
val = 0
For i = 1 To size

If Not Mid(argStr1, i, 1) = Mid(argStr2, i, 1) Then val = val + 1
Next i
countMismatch = val
End Function
'
Sub showMsg(ByVal argMsg As String)
Dim tCell As Range
Dim col As Integer

If Left(argMsg, 3) = "ERR" Then col = 255 Else col = 0
Set tCell = Cells(ROW_RESULT, 1)
With tCell
.Value = argMsg
.Font.Bold = True
.Font.Color = RGB(col, 0, 0)
End With
End Sub



"Madhan" wrote:
Hi, please find below a sample code. I hope it helps you. Try entering in A1
the main text and in A2 the text to be compared. Call myCompare from a macro.


Const ROW_MAIN As Integer = 1
Const ROW_OTHER As Integer = 2
Const ROW_RESULT As Integer = 3
'
Sub myCompare()


Dim str1, str2 As String
Dim tCell As Range


' GET THE TEXTS TO BE COMPARED
Set tCell = Cells(ROW_MAIN, 1)
str1 = Trim(tCell.Value)
Set tCell = Cells(ROW_OTHER, 1)
str2 = Trim(tCell.Value)
Set tCell = Nothing
' PERFORM CHAR-BY-CHAR COMPARISON AND COUNT MATCHES
Dim size1, size2, size3 As Long
Dim half, oneThird, percent1, percent2, percent3 As Double
Dim per, status, err_msg As String


size1 = Len(str1)
size2 = Len(str2)
err_msg = ""
' CHECK IF ANY TEXT IS EMPTY
If Not size1 = 0 And size2 = 0 Then


err_msg = "Please enter a text for comparison in row " & ROW_OTHER
GoTo prn_abnorm_result
End If
If size1 = 0 And Not size2 = 0 Then


err_msg = "Please enter a text for comparison in row " & ROW_MAIN
GoTo prn_abnorm_result
End If
If size1 = 0 And size2 = 0 Then


err_msg = "Please enter some text for comparison in rows " & ROW_MAIN & "
and " & ROW_OTHER
GoTo prn_abnorm_result
End If
' CHECK IF SIZES DO NOT MATCH
status = ""
per = "by 100"
If Not size1 = size2 Then


status = "not "
oneThird = size1 / 4
half = size1 / 2
If size2 = oneThird And size2 <= half Then
per = "between 50 and 75"
GoTo prn_norm_result
End If
If size2 < oneThird Then
per = "by more-than 75"
GoTo prn_norm_result
End If
If size2 size1 Then
per = "by more-than 100"
GoTo prn_norm_result
End If
End If
percent1 = Round(size1 / 100, 2)
size3 = countMismatch(str1, str2)
status = "not "
per = "by 100"
If Not size3 = 0 Then


If Not size3 = size1 Then


percent2 = Round(Abs(size2 - size3) / 100, 2)
percent3 = Round((percent2 / percent1) * 100, 2)
If percent3 = 50# Then status = "" Else status = "not "
per = "by " & percent3
End If
End If
prn_norm_result:
' PRINT NORMAL RESULT
showMsg "RESULT : Text in second row does " & status & "match that in first
row, " & per & " %"
GoTo end_of_sub
prn_abnorm_result:
showMsg "ERROR : " & err_msg
end_of_sub:
End Sub
'
Function countMismatch(ByVal argStr1 As String, ByVal argStr2 As String) As
Integer
Dim i, size As Long
Dim val As Integer


size = Len(argStr1)
val = 0
For i = 1 To size


If Not Mid(argStr1, i, 1) = Mid(argStr2, i, 1) Then val = val + 1
Next i
countMismatch = val
End Function
'
Sub showMsg(ByVal argMsg As String)
Dim tCell As Range
Dim col As Integer


If Left(argMsg, 3) = "ERR" Then col = 255 Else col = 0
Set tCell = Cells(ROW_RESULT, 1)
With tCell
.Value = argMsg
.Font.Bold = True
.Font.Color = RGB(col, 0, 0)
End With
Set tCell = Nothing
End Sub


" wrote:


On Feb 19, 11:38 am, Madhan wrote:
Hi, yes it is possible. You can do the following,
1. Find the number of characters in one cell and assume that it is 100%
2. Check character-by-character the exactness of characters in both the
cells and count the match
3. Calculate % from the count of matched characters


" wrote:
I asked this question in a roundabout way last week with no success.


Basically, is it possible to compare text of one cell to another cell
to produce a % of correctness. It doesn't have to be exact as I am
only using it to set up a French revision spreadsheet.


I know it's a tricky one but any help would be great. Over to the
experts!


Thanks


Tony- Hide quoted text -


- Show quoted text -


Thanks Madhan,
To be honest I am not sure how to do this and wouldn't know where to
start (my Excel knowledge is very limited) - can you help?


Thanks
Tony- Hide quoted text -


- Show quoted text -



Hi Madhan,
I have just returned to the office after an unexpected all day meeting
yesterday.
That is clever VBA coding but I can't get it to work properly.
For example:
in A1 I have the line "Je ne peux comprend pas ce que vous direz
" (correct translation)
in A2 I have the line "Je ne peux comprend ce que vous dire
" (my translation)

but the code returns in A3: ERROR : Text to be compared is shorter
than the original text


I was hoping it would tell me how much is correct (i.e. about 80%)
rather than tell me how long or how short it is if you know what I
mean

Regards
Tony

  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 48
Default Comparing text?

On Feb 19, 4:05 pm, Tom Ogilvy
wrote:
Why do you say no success. I answered your question with a good reference to
code that will do it.

--
Regards,
Tom Ogilvy



" wrote:
On Feb 19, 11:38 am, Madhan wrote:
Hi, yes it is possible. You can do the following,
1. Find the number of characters in one cell and assume that it is 100%
2. Check character-by-character the exactness of characters in both the
cells and count the match
3. Calculate % from the count of matched characters


" wrote:
I asked this question in a roundabout way last week with no success.


Basically, is it possible to compare text of one cell to another cell
to produce a % of correctness. It doesn't have to be exact as I am
only using it to set up a French revision spreadsheet.


I know it's a tricky one but any help would be great. Over to the
experts!


Thanks


Tony- Hide quoted text -


- Show quoted text -


Thanks Madhan,
To be honest I am not sure how to do this and wouldn't know where to
start (my Excel knowledge is very limited) - can you help?


Thanks
Tony- Hide quoted text -


- Show quoted text -



Hi Tom,
Was your reply meant for me...I don't see any posting from you

Regards
Tony

  #9   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Comparing text?

And I don't see an earlier post on this topic from you - but I know I
replied to such a question - maybe it wasn't you.


Levenshtein Distance Algorithm for string matching
http://www.merriampark.com/ld.htm (vb code implementation)

--
Regards,
Tom Ogilvy



wrote in message
ps.com...
On Feb 19, 4:05 pm, Tom Ogilvy
wrote:
Why do you say no success. I answered your question with a good
reference to
code that will do it.

--
Regards,
Tom Ogilvy



" wrote:
On Feb 19, 11:38 am, Madhan wrote:
Hi, yes it is possible. You can do the following,
1. Find the number of characters in one cell and assume that it is
100%
2. Check character-by-character the exactness of characters in both
the
cells and count the match
3. Calculate % from the count of matched characters


" wrote:
I asked this question in a roundabout way last week with no
success.


Basically, is it possible to compare text of one cell to another
cell
to produce a % of correctness. It doesn't have to be exact as I am
only using it to set up a French revision spreadsheet.


I know it's a tricky one but any help would be great. Over to the
experts!


Thanks


Tony- Hide quoted text -


- Show quoted text -


Thanks Madhan,
To be honest I am not sure how to do this and wouldn't know where to
start (my Excel knowledge is very limited) - can you help?


Thanks
Tony- Hide quoted text -


- Show quoted text -



Hi Tom,
Was your reply meant for me...I don't see any posting from you

Regards
Tony



  #10   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 48
Default Comparing text?

On 24 Feb, 05:22, "Tom Ogilvy" wrote:
And I don't see an earlier post on this topic from you - but I know I
replied to such a question - maybe it wasn't you.

Levenshtein Distance Algorithm for string matchinghttp://www.merriampark.com/ld.htm (vb code implementation)

--
Regards,
Tom Ogilvy

wrote in message

ps.com...



On Feb 19, 4:05 pm, Tom Ogilvy
wrote:
Why do you say no success. I answered your question with a good
reference to
code that will do it.


--
Regards,
Tom Ogilvy


" wrote:
On Feb 19, 11:38 am, Madhan wrote:
Hi, yes it is possible. You can do the following,
1. Find the number of characters in one cell and assume that it is
100%
2. Check character-by-character the exactness of characters in both
the
cells and count the match
3. Calculate % from the count of matched characters


" wrote:
I asked this question in a roundabout way last week with no
success.


Basically, is it possible to compare text of one cell to another
cell
to produce a % of correctness. It doesn't have to be exact as I am
only using it to set up a French revision spreadsheet.


I know it's a tricky one but any help would be great. Over to the
experts!


Thanks


Tony- Hide quoted text -


- Show quoted text -


Thanks Madhan,
To be honest I am not sure how to do this and wouldn't know where to
start (my Excel knowledge is very limited) - can you help?


Thanks
Tony- Hide quoted text -


- Show quoted text -


Hi Tom,
Was your reply meant for me...I don't see any posting from you


Regards
Tony- Hide quoted text -


- Show quoted text -



Perfect solution Tom,
I was able to implement it to my requirements.
Many thanks

Tony

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Comparing text and then adding numbers if the text matches rotor11 Excel Worksheet Functions 2 April 8th 09 08:38 PM
comparing text against a text table for yes no result Nigel Toates Excel Discussion (Misc queries) 3 November 30th 07 12:30 AM
Comparing Text beginner here Excel Worksheet Functions 7 July 18th 07 11:52 PM
Please help ... comparing text Sally M. Excel Worksheet Functions 2 June 10th 07 02:27 PM
comparing text bely Excel Programming 3 December 18th 03 10:03 PM


All times are GMT +1. The time now is 06:02 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"