I don't believe there is a way to do the kind of lookup you're looking for on this without a macro. I could be wrong, but if I'm not, here's a custom function for you.
This thing seems to work without any pre-processing. You would use it as such:
In the cell next to 1, the formula would be
=ReverseTrace(A10,$B$1:$B$7,-1)
Assuming:
- A10 is the location of "1" (the value you're looking up)
- $B$1:$B$7 is the location of your list of items (1, 2, 3 down to 2, 4)
- -1 is the offset from the column of this $B$1:$B$7 list that you want to query
Next to 2, it would therefore be =ReverseTrace(A11,$B$1:$B$7,-1)
Function ReverseTrace(varValue As Variant, lookupRange As Range, intTraceOffset As Integer)
Dim rngCell As Range
For Each rngCell In lookupRange
If InStr(1, CStr(rngCell.value), CStr(varValue)) > 0 Then
If Len(ReverseTrace) > 0 Then
ReverseTrace = ReverseTrace & ", " & rngCell.Offset(0, intTraceOffset)
Else
ReverseTrace = rngCell.Offset(0, intTraceOffset)
End If
End If
Next
End Function