check if reference exists, then return its value or return 0

D

doudou

Hi, thanks for any answer:
In sheet 1, colB, I want to check if ref. in colA also exists in
sheet2col.A, if yes, then return its valu from sheet2col.C, otherwise
(if doesn't exist), return a 0.
Any suggestion from someone ?
:confused:
 
J

JMB

=IF(ISERROR(VLOOKUP(A1,Sheet2!$A$1:$C$2,3,FALSE)),0,VLOOKUP(A1,Sheet2!$A$1:$C$2,3,FALSE))

you'll need to change Sheet2!$A$1:$C$2 to whatever range you are working
with on sheet2. for example, if you have 80 rows in your table change to
sheet2!$A$1:$C$80.

see help for VLOOKUP function - it can give you additional details about the
arguments.
 
Top