PLPE
added 3rd argument to determine number of words to be compared.
e.g.
=wfind(b1,a$1:a$10,3)
will compare first 3 words
Code
-------------------
Function wfind(r As Range, rng As Range, Optional cap As Integer) As String
Dim c As Range, txt1, txt2, flag As Boolean, i As Integer
txt1 = Split(r, " "): flag = False
If IsMissing(cap) Then
cap = UBound(txt1)
Else
cap = cap - 1
End If
For Each c In rng
txt2 = Split(c, " ")
For i = LBound(txt1) To cap
If Trim(txt1(i)) Like Trim(txt2(i)) & "*" Then
flag = True
Else
flag = False: Exit For
End If
If i = UBound(txt2) Then Exit For
Next
If flag = True Then
wfind = r & " Found": Exit Function
End If
Next
wfind = r & " not found"
End Function
-------------------
PLPE Wrote:
Column A & B do not match exactly, but are pretty close.
Originally, both columns had '_' & '@' included, but I added macros t
getr rid of these - easier to do comparisons (methinks!).
Here are some of my entries;
[Col A];
RD INP LKG 0V
RD INP LKG 5V25
[Col B];
RD INP LKG 5V25 nA
CS INP LKG 5V25 nA
[Col C];
RD INP LKG 5V25 - Found
CS INP LKG 5V25 nA - Not Found
{I think *Jindon* has me on the right track, but it's still not workin
for me!
--
jindo
-----------------------------------------------------------------------
jindon's Profile:
http://www.excelforum.com/member.php...fo&userid=1313
View this thread:
http://www.excelforum.com/showthread.php?threadid=37501