compare cell with a range

B

bagus

I have two worksheets :

Sheet 1:

A1 Country
B1 Product Code
C1 Product (empty cell - need to insert result of the formula in it)

Sheet 2:

A1-A1000 Product Code
B1-B1000 Product Name

I need to compare B1 (Sheet 1) with the range in A1-A1000 (Sheet 2) an
if they match than to retrieve the value from B cell (Sheet 2) an
insert it into C cell (sheet 1).

Can anyone help me. I know that it is trivial, but i have not made i
work till now.

/bagu
 
D

Dave Peterson

=if(iserror(vlookup(b1,sheet2!a:b,2,false)),"",vlookup(b1,sheet2!a:b,2,false))

Is one way.
 
B

bagus

HI Dave,

thanks for the quick reply. I have tried to match your instructions an
have managed only to get #NAME? as a result.

Anything that I am doing wrong?

Product codes contain both letters and numbers, and in addition symbol
(rare). Do I have to format the column to a specific format?

regards,

/bagus
 
D

Dave Peterson

Post the formula you tried.

Copy it from the formula bar (from excel) and paste it into your response.
 
B

bagus

Here is the formula I used:

=IF(ISERROR((VLOOKUP(Sheet1!C1;Sheet2!A:E;2;FALSE));"";VLOOKUP(Sheet1!C1;Sheet2!A:E;2;FALSE)))

Do you see the mistake?

/bagus

Dave said:
Post the formula you tried.

Copy it from the formula bar (from excel) and paste it into your
response.


HI Dave,

thanks for the quick reply. I have tried to match your instructions and
have managed only to get #NAME? as a result.

Anything that I am doing wrong?

Product codes contain both letters and numbers, and in addition symbols
(rare). Do I have to format the column to a specific format?

regards,

/bagus

 
D

Dave Peterson

Watch your parentheses:

=IF(ISERROR(VLOOKUP(Sheet1!C1;Sheet2!A:E;2;FALSE));"";
VLOOKUP(Sheet1!C1;Sheet2!A:E;2;FALSE))

I don't see a problem that would cause a #name? error, though. Are you using an
English version of excel?

If not, you'll have to translate =iserror() and =vlookup() to your language.

If you post the language you use, maybe someone can help.
Here is the formula I used:

=IF(ISERROR((VLOOKUP(Sheet1!C1;Sheet2!A:E;2;FALSE));"";VLOOKUP(Sheet1!C1;Sheet2!A:E;2;FALSE)))

Do you see the mistake?

/bagus

Dave said:
Post the formula you tried.

Copy it from the formula bar (from excel) and paste it into your
response.


HI Dave,

thanks for the quick reply. I have tried to match your instructions and
have managed only to get #NAME? as a result.

Anything that I am doing wrong?

Product codes contain both letters and numbers, and in addition symbols
(rare). Do I have to format the column to a specific format?

regards,

/bagus
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top