I have a function that takes 2 search values and 2 columns and 1 result column (total 5 arguments) and returns the value from the last column if the first two conditions are met. But it doesn't work and returns VALUE error. I can't figure out what's wrong here. 
 Function betterSearch(searchValue1 As Variant, searchValue2 As Variant, _
            searchColumn1 As Variant, searchColumn2 As Variant, _
            resultColumn As Variant)
    Dim i As Integer
    For i = 1 To searchColumn1.Rows.Count
        If searchColumn1.Cells(i, 1).Value = searchValue1 _
                    And searchColumn2.Cells(i, 2).Value = searchValue2 Then
            betterSearch = resultColumn.Cells(i, 1)
                MsgBox ("found")
                Exit For
        End If
        betterSearch = "Not found"
    Next
End Function
 
     
    