Custom Function VLookup

M

Martin

Hello,

Can anyone tell me if this custom function could work like this or I must
define anything alse ?:

Function CustomVLookup(valuename)
CustomVLookup = VLookup(valuename, A1:B1, 2, False)
End Function

Thanks
 
T

Tom Ogilvy

Sure you want A1:B1?

why not try

=if(A1<>Valuename,na(),B1)

anyway,

Function CustomVLookup(valuename)
CustomVLookup = Evaluate("VLookup(" & _
Valuename & ", A1:B1, 2, False)
End Function

Good change this will not recalculate if you change anything in A1:B1
 
Top