Hi All, I'm happy with my code except for one last little bit. What it does is compare comma-separated values in two cells.
The value of Cell1 = 1,2,3,4,5,6,7,8,9,10,11,12,13,14
The value of Cell2 = 12,13,14,15,16,17,18,19,20
the cell with =SPACE_OVERLAP(A1,A2) should be "12,13,14" but as it is, it's just coming up as "14"
Public Function SPACE_OVERLAP(ByRef Cell1 As Range, ByRef Cell2 As Range) As String
Dim ARR1() As String
Dim ARR2() As String
Dim i As Integer
Dim n As Integer
ARR1 = Split(Cell1.Value, ",")
ARR2 = Split(Cell2.Value, ",")
For i = LBound(ARR1) To UBound(ARR1)
For n = LBound(ARR2) To UBound(ARR2)
If ARR1(i) = ARR2(n) Then
SPACE_OVERLAP = ARR2(n)
End If
Next n
Next i
End Function
Thanks!
-Andrew
Bookmarks