I didn't catch that, sorry. I was assuming you would pass the cell you were checking to the function. Here's a version that doesn't need an input.
VB Code:
Function tobian() As Long Dim LookupValue As Variant Dim rngMatrix As Range Application.Volatile LookupValue = Application.Caller.Offset(1, -1).Value Set rngMatrix = ThisWorkbook.Worksheets(1).Range("B4:C11") If rngMatrix.Find(What:=LookupValue, _ LookIn:=xlValues, _ LookAt:=xlWhole, _ MatchCase:=False) Is Nothing Then tobian = 0 Else tobian = 2 End If Set rngMatrix = Nothing End Function




Reply With Quote