Thread: Search
View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.misc
Malik Malik is offline
external usenet poster
 
Posts: 47
Default Search

is this a macro u wrote? i m sorry i though there might be a simpler formula
that can be used. anyways thx as i dont pretty well understand macros.


"Joel" wrote:

You need a custom function. Try the one below. I wrote a very simple method
of perfoming you request, but it has some limitations. If in the 2nd string
you have 13 it will match any number with 13 in it such as 135, 313,1013. if
this is a problem I can modify the function. this is just a simple solution.

Call with
=findtext(B1,A1)

Function findtext(Parm1 As String, Parm2 As String) As String
Dim NewNum As String
Dim ParseString As String

findtext = ""
ParseString = Parm1
Do While Len(ParseString) 0
CommaPos = InStr(ParseString, ",")
If CommaPos 0 Then
NewNum = Trim(Left(ParseString, CommaPos - 1))
ParseString = Trim(Mid(ParseString, CommaPos + 1))
Else
NewNum = Trim(ParseString)
ParseString = ""
End If

If InStr(Parm2, NewNum) = 0 Then
If Len(findtext) = 0 Then
findtext = NewNum
Else
findtext = findtext & ", " & NewNum
End If
End If
Loop


End Function

"Malik" wrote:

I have a set of digits in one cell separated by a comma and a bigger set or
master set of digits in the other cell. Is there a formula where I can
segregate the unmatching digits of the two cells onto the third cell

E.g,.

A1: 121, 211, 244
B1: 121, 211, 1314, 566, 667
What I want as result:
C1: 1314, 566, 667 (ideally B1 - A1)

Thanks