I have written the following UDF function to return True if a cell value is found in a specified range and return False otherwise:
Function find_in_range(value_to_find As Variant, lookup_range As Range) As Boolean
For Each cell In lookup_range.Cells.SpecialCells(xlConstants)
If cell.Value = value_to_find Then
find_in_range = True
Exit For
Else
find_in_range = False
End If
Next cell
End Function
However, it is considerably slower than let's say VLOOKUP.
Why is that so? Is there a way to make it faster? What magic is used to make VLOOKUP search faster?