Extend Custom function

C

Chad

Hi

Someone was kind enough to post this custom function. What it does is
assess if a lookup is valid if it is it does one thing, if not
another.

However if I have a fomula which either the true or false component
returns an #NA then I get a #VALUE! Error. I don't want to wrap the
custom function with an if iserror formula as the idea was to make the
long formula shorter. Can someone provide some more insight?

Lookup here
=checkit(A7,VLOOKUP(A7,YesSheet!$A$2:$B$30,2,0),VLOOKUP(A7,NoSheet!$A
$2:$B$30,2,0))

Custom function here

Function Checkit(target As String, MatchResults As String,
NonMatchResults As String)

Select Case target
Case "A", "B", "C"
Checkit = MatchResults
Case Else
Checkit = NonMatchResults
End Select

End Function
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top