Column A | Column B |
---|---|
1 | |
2 | 1 |
3 | 1 |
4 | |
5 | 1,4 |
etc |
Trying to figure out how to search if a Number in Column A exists anywhere in Column B.
So far I've tried:
=IF(ISNUMBER(SEARCH(A2,B:B)),"YES","NO") which returns #spill
Function CheckOne(rng As Range, chkValue As Long) As Boolean
Dim n
For Each n In Split(rng.Value, ",")
If CLng(n) = chkValue Then
CheckOne = True
Exit For
End If
Next n
End Function
Function CommaSeparatedListContains(ByVal csv As String, ByVal v As String, _
Optional ByVal delimiter As String = ",") As Boolean
Dim i As Long
Dim splitCsv() As String
splitCsv = Split(csv, delimiter)
CommaSeparatedListContains = False
For i = LBound(splitCsv) To UBound(splitCsv)
If splitCsv(i) = v Then
CommaSeparatedListContains = True
Exit Function
End If
Next i
End Function
This didn't work either as I'm getting #VALUE! error
I suspect it's because the value I am looking for occurs more than once in column B.
What am I doing wrong here?