Try this. You will have to change the value of the rngMatrix variable to your named range.
VB Code:
Function tobian(ByVal LookupValue As Variant) As Long Dim rngMatrix As Range 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