I have a macro which compares the first 20 characters of strings in two columns, when the customer type is "O" and gives the results. But I need to compare these two columns and if 80% of the strings match, i need to get the result as "ok" else "check". Can someone help me with correcting my code. Thanks
Sub Macro1()
'
'Match Organization names only the first 20 characters
'
'
Dim sht As Worksheet
Dim LR As Long
Dim i As Long
Dim str As String, str1 As String
Set sht = ActiveWorkbook.Worksheets("ORD_CS")
LR = sht.UsedRange.Rows.Count
With sht
For i = 8 To LR
If CStr(.Range("Q" & i).Value) = "O" Then
str = Left(.Range("S" & i).Value, 20)
str1 = Left(.Range("U" & i).Value, 20)
If str = str1 Then
Range("V" & i).Value = "ok"
Else
Range("V" & i).Value = "check"
End If
End If
Next i
End With
End Sub