+ Reply to Thread
Results 1 to 4 of 4

Lookup formula returning same value for multiple lookup values

  1. #1
    Registered User
    Join Date
    10-10-2005
    Posts
    1

    Lookup formula returning same value for multiple lookup values

    I am using a formula to retrieve information from one worksheet to another.

    To simplify my issue, see if you can understand the example below:

    1. Open a new worksheet
    2. In Column A, enter the numbers 1 thru 9 down the column
    3. In Column B, enter the numbers A thru I down the column
    4. In Column F, list the following numbers down the column: 5, 9, 4, 12, 6, 7, 22, 3, 450
    5. In Column G, enter the formula: =LOOKUP(F1,$A$1:$A$9,$B$1:$B$9)
    6. Copy the formula down and look at the results.

    For the values 12, 22 and 450, the logic should have failed, but returns the bottom-most value from the return value array.

    Basically, I am trying to compare two lists, and when an item does not appear in the first list, it should return a blank value. If the item does appear, then it should return the corresponding value for a cell on the sheet.

    Any ideas?

    Thanks for you help!

    Take care.

    RPW

  2. #2
    Forum Expert swatsp0p's Avatar
    Join Date
    10-07-2004
    Location
    Kentucky, USA
    MS-Off Ver
    Excel 2010
    Posts
    1,545
    Instead of using LOOKUP, use VLOOKUP and check for FALSE. If FALSE, return a blank (""), as such:

    =IF(ISNA(VLOOKUP(F1,$A$1:$B$9,2,0)),"",VLOOKUP(F1,$A$1:$B$9,2,0))

    note the "0" in the formula is the same as FALSE, meaning if an exact match isn't found, #N/A will be returned. The IF checks for this error and returns a blank if the error is found. If no error, then return the value in the second column (col B).

    HTH
    Bruce
    The older I get, the better I used to be.
    USA

  3. #3
    PCLIVE
    Guest

    Re: Lookup formula returning same value for multiple lookup values

    Here's one way:

    =IF(COUNTIF($A$1:$A$9,F1)=0,"",(LOOKUP(F1,$A$1:$A$9,$B$1:$B$9)))

    Best Regards,
    Paul

    "wellsrp" <[email protected]> wrote in
    message news:[email protected]...
    >
    > I am using a formula to retrieve information from one worksheet to
    > another.
    >
    > To simplify my issue, see if you can understand the example below:
    >
    > 1. Open a new worksheet
    > 2. In Column A, enter the numbers 1 thru 9 down the column
    > 3. In Column B, enter the numbers A thru I down the column
    > 4. In Column F, list the following numbers down the column: 5, 9, 4,
    > 12, 6, 7, 22, 3, 450
    > 5. In Column G, enter the formula: =LOOKUP(F1,$A$1:$A$9,$B$1:$B$9)
    > 6. Copy the formula down and look at the results.
    >
    > For the values 12, 22 and 450, the logic should have failed, but
    > returns the bottom-most value from the return value array.
    >
    > Basically, I am trying to compare two lists, and when an item does not
    > appear in the first list, it should return a blank value. If the item
    > does appear, then it should return the corresponding value for a cell
    > on the sheet.
    >
    > Any ideas?
    >
    > Thanks for you help!
    >
    > Take care.
    >
    > RPW
    >
    >
    > --
    > wellsrp
    > ------------------------------------------------------------------------
    > wellsrp's Profile:
    > http://www.excelforum.com/member.php...o&userid=27974
    > View this thread: http://www.excelforum.com/showthread...hreadid=474764
    >




  4. #4
    L. Howard Kittle
    Guest

    Re: Lookup formula returning same value for multiple lookup values

    Hi RPW,

    Maybe this will do what you want.

    =IF(ISNA(VLOOKUP(F1,$A$1:$B$9,2,0)),0,VLOOKUP(F1,$A$1:$B$9,2,0))

    HTH
    Regards,
    Howard

    "wellsrp" <[email protected]> wrote in
    message news:[email protected]...
    >
    > I am using a formula to retrieve information from one worksheet to
    > another.
    >
    > To simplify my issue, see if you can understand the example below:
    >
    > 1. Open a new worksheet
    > 2. In Column A, enter the numbers 1 thru 9 down the column
    > 3. In Column B, enter the numbers A thru I down the column
    > 4. In Column F, list the following numbers down the column: 5, 9, 4,
    > 12, 6, 7, 22, 3, 450
    > 5. In Column G, enter the formula: =LOOKUP(F1,$A$1:$A$9,$B$1:$B$9)
    > 6. Copy the formula down and look at the results.
    >
    > For the values 12, 22 and 450, the logic should have failed, but
    > returns the bottom-most value from the return value array.
    >
    > Basically, I am trying to compare two lists, and when an item does not
    > appear in the first list, it should return a blank value. If the item
    > does appear, then it should return the corresponding value for a cell
    > on the sheet.
    >
    > Any ideas?
    >
    > Thanks for you help!
    >
    > Take care.
    >
    > RPW
    >
    >
    > --
    > wellsrp
    > ------------------------------------------------------------------------
    > wellsrp's Profile:
    > http://www.excelforum.com/member.php...o&userid=27974
    > View this thread: http://www.excelforum.com/showthread...hreadid=474764
    >




+ 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