'so:
'(0): in arr1 not arr2
'(1): in arr2 not arr1
'(2): in both
'note: could just use array(udic1.keys, etc) to assign return val,
'but like to keep 0 base consistent
Function getDifferencesA(arr1, arr2, _
Optional skipBlanks As Boolean = True, _
Optional matchCase As Boolean = True, _
Optional tst As Boolean) As Variant
Dim uDic1 As Object, uDic2 As Object, uDic3 As Object
Dim Var As Variant
Dim tmpArr(0 To 2) As Variant
Dim funcTest As Boolean
Dim tStr As String
tst = False
On Error GoTo exitFunc
'if either range is nothing then exit (this is a custom function just to check if arrays are one dim, initialized, simple)
'If Not validArray(arr1) Then GoTo exitFunc
'If Not validArray(arr2) Then GoTo exitFunc
'creates 3 dics using late binding...increase speed set reference
Set uDic1 = CreateObject("scripting.dictionary")
Set uDic2 = CreateObject("scripting.dictionary")
Set uDic3 = CreateObject("scripting.dictionary")
If Not matchCase Then uDic1.compareMode = vbTextCompare: uDic2.compareMode = vbTextCompare: uDic3.compareMode = vbTextCompare
For Each Var In arr1
tStr = CStr(Var)
If skipBlanks Then If tStr = vbNullString Then GoTo skipAdd
uDic1(tStr) = Empty
skipAdd:
Next
'not sure if this is the best way, but it is certainly A way
With uDic1
For Each Var In arr2
tStr = CStr(Var)
If skipBlanks Then If tStr = vbNullString Then GoTo skipAdd1
If Not .Exists(tStr) Then
If Not uDic3.Exists(tStr) Then uDic2(tStr) = Empty
Else: uDic3(tStr) = Empty: .Remove tStr
End If
skipAdd1:
Next
'the return of this could be changed..ie specified, so as not to return unwanted
'params...however making it consistent is ok too
'add this so as always to return 0 based
tmpArr(0) = .Keys
tmpArr(1) = uDic2.Keys
tmpArr(2) = uDic3.Keys
End With
'assign return val
getDifferencesA = tmpArr
tst = True
exitFunc:
End Function