PC Review


Reply
Thread Tools Rate Thread

Comparing text?

 
 
annysjunkmail@tiscali.co.uk
Guest
Posts: n/a
 
      19th Feb 2007
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

 
Reply With Quote
 
 
 
 
=?Utf-8?B?TWFkaGFu?=
Guest
Posts: n/a
 
      19th Feb 2007
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

"(E-Mail Removed)" 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
>
>

 
Reply With Quote
 
annysjunkmail@tiscali.co.uk
Guest
Posts: n/a
 
      19th Feb 2007
On Feb 19, 11:38 am, Madhan <Mad...@discussions.microsoft.com> 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
>
>
>
> "annysjunkm...@tiscali.co.uk" 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


 
Reply With Quote
 
=?Utf-8?B?TWFkaGFu?=
Guest
Posts: n/a
 
      19th Feb 2007
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


"(E-Mail Removed)" wrote:

> On Feb 19, 11:38 am, Madhan <Mad...@discussions.microsoft.com> 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
> >
> >
> >
> > "annysjunkm...@tiscali.co.uk" 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
>
>
>

 
Reply With Quote
 
=?Utf-8?B?TWFkaGFu?=
Guest
Posts: n/a
 
      19th Feb 2007
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
>
>
> "(E-Mail Removed)" wrote:
>
> > On Feb 19, 11:38 am, Madhan <Mad...@discussions.microsoft.com> 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
> > >
> > >
> > >
> > > "annysjunkm...@tiscali.co.uk" 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
> >
> >
> >

 
Reply With Quote
 
=?Utf-8?B?VG9tIE9naWx2eQ==?=
Guest
Posts: n/a
 
      19th Feb 2007
Why do you say no success. I answered your question with a good reference to
code that will do it.


--
Regards,
Tom Ogilvy


"(E-Mail Removed)" wrote:

> On Feb 19, 11:38 am, Madhan <Mad...@discussions.microsoft.com> 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
> >
> >
> >
> > "annysjunkm...@tiscali.co.uk" 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
>
>
>

 
Reply With Quote
 
annysjunkmail@tiscali.co.uk
Guest
Posts: n/a
 
      21st Feb 2007
On Feb 19, 3:05 pm, Madhan <Mad...@discussions.microsoft.com> 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

>
> > "annysjunkm...@tiscali.co.uk" wrote:

>
> > > On Feb 19, 11:38 am, Madhan <Mad...@discussions.microsoft.com> 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

>
> > > > "annysjunkm...@tiscali.co.uk" 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

 
Reply With Quote
 
annysjunkmail@tiscali.co.uk
Guest
Posts: n/a
 
      21st Feb 2007
On Feb 19, 4:05 pm, Tom Ogilvy <TomOgi...@discussions.microsoft.com>
wrote:
> Why do you say no success. I answered your question with a good reference to
> code that will do it.
>
> --
> Regards,
> Tom Ogilvy
>
>
>
> "annysjunkm...@tiscali.co.uk" wrote:
> > On Feb 19, 11:38 am, Madhan <Mad...@discussions.microsoft.com> 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

>
> > > "annysjunkm...@tiscali.co.uk" 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

 
Reply With Quote
 
Tom Ogilvy
Guest
Posts: n/a
 
      24th Feb 2007
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



<(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> On Feb 19, 4:05 pm, Tom Ogilvy <TomOgi...@discussions.microsoft.com>
> wrote:
>> Why do you say no success. I answered your question with a good
>> reference to
>> code that will do it.
>>
>> --
>> Regards,
>> Tom Ogilvy
>>
>>
>>
>> "annysjunkm...@tiscali.co.uk" wrote:
>> > On Feb 19, 11:38 am, Madhan <Mad...@discussions.microsoft.com> 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

>>
>> > > "annysjunkm...@tiscali.co.uk" 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
>



 
Reply With Quote
 
annysjunkmail@tiscali.co.uk
Guest
Posts: n/a
 
      28th Feb 2007
On 24 Feb, 05:22, "Tom Ogilvy" <twogi...@msn.com> 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
>
> <annysjunkm...@tiscali.co.uk> wrote in message
>
> news:(E-Mail Removed)...
>
>
>
> > On Feb 19, 4:05 pm, Tom Ogilvy <TomOgi...@discussions.microsoft.com>
> > wrote:
> >> Why do you say no success. I answered your question with a good
> >> reference to
> >> code that will do it.

>
> >> --
> >> Regards,
> >> Tom Ogilvy

>
> >> "annysjunkm...@tiscali.co.uk" wrote:
> >> > On Feb 19, 11:38 am, Madhan <Mad...@discussions.microsoft.com> 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

>
> >> > > "annysjunkm...@tiscali.co.uk" 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 With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
RE: Comparing text and then adding numbers if the text matches Gary''s Student Microsoft Excel Worksheet Functions 0 8th Apr 2009 08:38 PM
RE: Comparing text and then adding numbers if the text matches Mike H Microsoft Excel Worksheet Functions 0 8th Apr 2009 08:36 PM
comparing text against a text table for yes no result Nigel Toates Microsoft Excel Misc 3 30th Nov 2007 12:30 AM
Comparing Text =?Utf-8?B?YmVnaW5uZXIgaGVyZQ==?= Microsoft Excel Worksheet Functions 7 18th Jul 2007 11:52 PM
Comparing text Dan Microsoft Access Forms 4 16th Jun 2004 11:24 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 10:15 AM.