+ Reply to Thread
Results 1 to 7 of 7

compare cell with a range

  1. #1
    Registered User
    Join Date
    06-12-2006
    Posts
    3

    compare cell with a range

    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) and if they match than to retrieve the value from B cell (Sheet 2) and insert it into C cell (sheet 1).

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

    /bagus

  2. #2
    Don Guillett
    Guest

    Re: compare cell with a range

    Have a look in vba help index for FINDNEXT. There is an example.

    --
    Don Guillett
    SalesAid Software
    [email protected]
    "bagus" <[email protected]> wrote in
    message news:[email protected]...
    >
    > 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) and
    > if they match than to retrieve the value from B cell (Sheet 2) and
    > insert it into C cell (sheet 1).
    >
    > Can anyone help me. I know that it is trivial, but i have not made it
    > work till now.
    >
    > /bagus
    >
    >
    > --
    > bagus
    > ------------------------------------------------------------------------
    > bagus's Profile:
    > http://www.excelforum.com/member.php...o&userid=35323
    > View this thread: http://www.excelforum.com/showthread...hreadid=550980
    >




  3. #3
    Dave Peterson
    Guest

    Re: compare cell with a range

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

    Is one way.

    bagus wrote:
    >
    > 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) and
    > if they match than to retrieve the value from B cell (Sheet 2) and
    > insert it into C cell (sheet 1).
    >
    > Can anyone help me. I know that it is trivial, but i have not made it
    > work till now.
    >
    > /bagus
    >
    > --
    > bagus
    > ------------------------------------------------------------------------
    > bagus's Profile: http://www.excelforum.com/member.php...o&userid=35323
    > View this thread: http://www.excelforum.com/showthread...hreadid=550980


    --

    Dave Peterson

  4. #4
    Registered User
    Join Date
    06-12-2006
    Posts
    3

    Re: compare cell with a range

    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

    Quote Originally Posted by Dave Peterson
    =if(iserror(vlookup(b1,sheet2!a:b,2,false)),"",vlookup(b1,sheet2!a:b,2,false))

    Is one way.

    bagus wrote:
    >
    > 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) and
    > if they match than to retrieve the value from B cell (Sheet 2) and
    > insert it into C cell (sheet 1).
    >
    > Can anyone help me. I know that it is trivial, but i have not made it
    > work till now.
    >
    > /bagus
    >
    > --
    > bagus
    > ------------------------------------------------------------------------
    > bagus's Profile: http://www.excelforum.com/member.php...o&userid=35323
    > View this thread: http://www.excelforum.com/showthread...hreadid=550980


    --

    Dave Peterson

  5. #5
    Dave Peterson
    Guest

    Re: compare cell with a range

    Post the formula you tried.

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



    bagus wrote:
    >
    > 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
    >
    > Dave Peterson Wrote:
    > > =if(iserror(vlookup(b1,sheet2!a:b,2,false)),"",vlookup(b1,sheet2!a:b,2,false))
    > >
    > > Is one way.
    > >
    > > bagus wrote:
    > > >
    > > > 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)

    > > and
    > > > if they match than to retrieve the value from B cell (Sheet 2) and
    > > > insert it into C cell (sheet 1).
    > > >
    > > > Can anyone help me. I know that it is trivial, but i have not made

    > > it
    > > > work till now.
    > > >
    > > > /bagus
    > > >
    > > > --
    > > > bagus
    > > >

    > > ------------------------------------------------------------------------
    > > > bagus's Profile:

    > > http://www.excelforum.com/member.php...o&userid=35323
    > > > View this thread:

    > > http://www.excelforum.com/showthread...hreadid=550980
    > >
    > > --
    > >
    > > Dave Peterson

    >
    > --
    > bagus
    > ------------------------------------------------------------------------
    > bagus's Profile: http://www.excelforum.com/member.php...o&userid=35323
    > View this thread: http://www.excelforum.com/showthread...hreadid=550980


    --

    Dave Peterson

  6. #6
    Registered User
    Join Date
    06-12-2006
    Posts
    3

    Re: compare cell with a range

    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

    [QUOTE=Dave Peterson]Post the formula you tried.

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



    bagus wrote:[color=blue]
    >
    > 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
    >
    > Dave Peterson Wrote:[color=green]
    > > =if(iserror(vlookup(b1,sheet2!a:b,2,false)),"",vlookup(b1,sheet2!a:b,2,false))
    > >
    > > Is one way.
    > >
    > > bagus wrote:
    > > >
    > > > 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)

    > > and
    > > > if they match than to retrieve the value from B cell (Sheet 2) and
    > > > insert it into C cell (sheet 1).
    > > >
    > > > Can anyone help me. I know that it is trivial, but i have not made

    > > it[color=darkred]
    > > > work till now.
    > > >
    > > > /bagus
    Last edited by bagus; 06-13-2006 at 02:35 AM.

  7. #7
    Dave Peterson
    Guest

    Re: compare cell with a range

    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.

    bagus wrote:[color=blue]
    >
    > 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 Peterson Wrote:[color=green]
    > > Post the formula you tried.
    > >
    > > Copy it from the formula bar (from excel) and paste it into your
    > > response.
    > >
    > >
    > >
    > > bagus wrote:
    > > >
    > > > 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[color=darkred]
    > > > (rare). Do I have to format the column to a specific format?
    > > >
    > > > regards,
    > > >
    > > > /bagus
    > > >
    > > > Dave Peterson Wrote:
    > > > >

    > > =if(iserror(vlookup(b1,sheet2!a:b,2,false)),"",vlookup(b1,sheet2!a:b,2,false))
    > > > >
    > > > > Is one way.
    > > > >
    > > > > bagus wrote:
    > > > > >
    > > > > > 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)
    > > > > and
    > > > > > if they match than to retrieve the value from B cell (Sheet 2)

    > > and
    > > > > > insert it into C cell (sheet 1).
    > > > > >
    > > > > > Can anyone help me. I know that it is trivial, but i have not

    > > made
    > > > > it
    > > > > > work till now.
    > > > > >
    > > > > > /bagus

    >
    > --
    > bagus
    > ------------------------------------------------------------------------
    > bagus's Profile: http://www.excelforum.com/member.php...o&userid=35323
    > View this thread: http://www.excelforum.com/showthread...hreadid=550980


    --

    Dave Peterson

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1