View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default look up and ISNA in vba

Using WorksheetFunction as a qualifier results in a trappable error rather
than return N/A when the value is not found. If you just use application
as the qualifier, then N/A is returned.

Dim res as Variant

res = Application.Lookup(Range("A3"),Range("t!A:A"),Rang e("t!C:C"))
if iserror(res) then
msgbox Range("A3").Value & " not found"
res = 0
else
msgbox "Found, return is " & res
End if

'at this point, res holds zero or the value returned.


So you don't need to do two lookups in VBA.

--
Regards,
Tom Ogilvy

"nyn04 " wrote in message
...
IF(ISNA(LOOKUP(A3,t!A:A,t!C:C))<TRUE,(LOOKUP(A3,t !A:A,t!C:C)),0)

this is the complete excel function that I am trying to code

thanks


---
Message posted from http://www.ExcelForum.com/