Home |
Search |
Today's Posts |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi Jay Dean
This should do what you are looking for: Public Function MyFun(String1 As String, String2 As String) As Boolean Dim arr1 As Variant Dim arr2 As Variant If String1 = "" Or String2 = "" Then Exit Function End If If InStr(1, String1, ",") Then arr1 = Split(String1, ",") Else ReDim arr1(0) arr1(0) = String1 End If If InStr(1, String2, ",") Then arr2 = Split(String2, ",") Else ReDim arr2(0) arr2(0) = String2 End If For c = LBound(arr2) To UBound(arr2) For r = LBound(arr1) To UBound(arr1) If arr2(c) = arr1(r) Then Token = Token + 1 Exit For End If Next Next If Token = UBound(arr2) + 1 Then MyFun = True End If End Function Regards, Per "jay dean" skrev i meddelelsen ... Hi - I'm looking for a Boolean VBA function, MyFun, that takes in 2 input strings, String1 and String2, like MyFun(String1,String2). Here are the specs: (1) If ALL the tokens in String2 are also tokens of String1, then MyFun will output to "True", otherwise, it should return "False" (2) Also, if either String1 or String2 is empty "", then MyFun will return "False" (3) The tokens in both input strings are delimited by "," except when there is only one token contained in any input. Example: MyFun("YH,L,GT,W,B,Q","B,GT,YH") should return "True" MyFun("H,C,KK,V","") should return "False" MyFun("AY,DC,GJ,U","AY,U,Z") should return "False" I would appreciate any assistance! Thank you. Jay Dean *** Sent via Developersdex http://www.developersdex.com *** |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
date boolean function | Excel Worksheet Functions | |||
Database Function Criteria Boolean Operations | Excel Worksheet Functions | |||
how can the lookup function work with two boolean functions | Excel Programming | |||
Using boolean function for color fill | Excel Worksheet Functions |