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

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 = 0
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.228qdz_1138276809.0729@excelfor um-nospam.com...

I use the following type of function a lot:

if(iserror(vlookup(a,sheet2!$a$1:$d$15,2,0)),0,vlo okup(a,sheet2!$a$1:$d$15,2
,0))

I want to replace this with:
taz(a,sheet2!$a$1:$d$15,2)

the following is my current attempt which doesnt quite work,
many thanks for any help

Function taz(a, b, c)

taz = WorksheetFunction.VLookup(a, b, c, 0)

If WorksheetFunction.IsError(taz) Then
taz = 0
Else: taz
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