mellenburg11
Programmer
I have two arrays, A and B. B is a subset of A. I would like to create array C that contains the elements of A that are not in B. How do I do this?
Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
Function ArraySubtract(arrayA,arrayB)
Dim bContents, delim
delim = "##DELIM##"
bContents = delim & Join(arrayB,delim) & delim
Dim subContents, ctrA
For ctrA = 0 to UBound(arrayA)
If InStr(bContents,delim & arrayA(ctrA) & delim) > 0 Then subContents = subCOntents & arrayA & delim
Next
If len(subContents) > 0 Then subContents = Left(subContents,Len(subContents) - len(delim))
ArraySubtract = Split(subContacts, delim)
End Function