View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Bob Phillips
 
Posts: n/a
Default Shortening a vlookup

Try this version

Function taz(a, b, c)

On Error Resume Next
taz = WorksheetFunction.VLookup(a, b, c, 0)
On Error GoTo 0
If IsEmpty(taz) Then
taz = 5
End If
End Function


--

HTH

Bob Phillips

(remove nothere from the email address if mailing direct)

"T De Villiers"
wrote in message
news:T.De.Villiers.228spa_1138279803.9027@excelfor um-nospam.com...

Thanks for this, another question though, just say I want the output to
be 5
when there is an error, why doesnt the following work, many thanks:

Function taz(a, b, c)

On Error Resume Next
taz = WorksheetFunction.VLookup(a, b, c, 0)
On Error GoTo 0
If IsError(taz) Then
taz = 5
End If
End Function


--
T De Villiers
------------------------------------------------------------------------
T De Villiers's Profile:

http://www.excelforum.com/member.php...o&userid=26479
View this thread: http://www.excelforum.com/showthread...hreadid=505271